Alice 3 program | Computer Science homework help

Program Requirements This Alice program will contain 2 scenes. In the first scene, two cars will pop wheelies multiple times. In the second scene, the two cars will race towards an object in the middle of the scene and see who wins. Create an Alice program that minimally does the following:

Setting the Scene

 Start with a blank slate.

 Add two sports car objects (from the Automobile class, within the Transport class) to the scene, and adjust the car heights to both be size1.

 Turn the cars so they are facing each other.

 Use the middle camera adjustment arrow to zoom out a bit so you can see more of the scene (click on arrow at least 5 times).

 Move the cars to either side of the screen, at the same Z-axis position — one on the far left side of the screen facing right, and one on the far right side of the screen facing left (make sure both cars are fully visible when you run your code).

 Place an object from the Prop class in the middle of the scene between the two cars, also at the same Z-axis position. Make the Prop object fairly small. Creating Methods

 Add two scene methods, doScene1 and doScene2.

 Add a shot method called race, which will run from within the doScene2.

 Within the Automobile class, add a procedure method called popWheelie, which causes an automobile to pop a wheelie. Coding the Actions Add code to the popWheelie method to make a sports car:

 Simultaneously:

o Spin (turn) its back wheels several rotations.

o Raise the front end of the car (turn) a small amount off the ground.

 Return the car to the ground. Add code to the doScene1 method to:

 Create a variable and store the half of the height of the Prop object in the variable.

 In a count loop, make the Prop object perform the following tasks three times in a row:

o Spin around 360 degrees.

o Move up by half its height o Move down by half its height

 Prompt the user to enter how many times the cars should pop wheelies.

 In a while loop, validate the number of times entered: o If the number of times entered is less than 1

 Have one of the cars say that it must pop at least one wheelie

 Read another value from the user Loop until a valid value is entered (1 or more).

 In a count loop:

o Simultaneously invoke the popWheelie method for both cars, to make both cars pop the specified number of wheelies, at the same time.

Add code to the doScene2 method to:

 Create a variable and store the distance from the left car to the Prop object in the variable.

 Create a second variable and store the distance from the right car to the Prop object in the variable.

 Have the each car say how far it is from the Prop object.

 Create a variable moveLeftCarDistance to hold the distance the left car will move each time, and set it to be one tenth of the distance from the left car to the Prop object.

 Create a variable to hold a move factor for the right car.

 Have the right car ask the user what factor to use to move it, and explain that it must be a double between 5 and 15. Store the user input into the move factor variable.

 Within a while loop

o Test to see whether the move factor the user entered is invalid (i.e. between 5 and 15)

o If the value entered is invalid

 Have the right car say why the factor entered is incorrect

 Prompt for and read another value into the move factor. Loop until a valid value is entered.

 Create a variable moveRightCarDistance to hold the distance the right car will move each time, and set it to the value of the distance from the right car to the Prop object divided by the move factor.

 Invoke the race method to make the cars race to the Prop object. o Pass the two move distance variables as arguments to the race method.

Add code to the race method to:

 Take 2 parameters o The first parameter defines the amount that the left car will move each time.

o The second parameter defines the amount that the right car will move each time.

 Create a Boolean variable that will indicate whether the race should continue, and set it to an initial value of true.

 In a while loop that runs as long as the boolean is true:

o Move the left car forward by its parameter amount

o Move the right car forward by its parameter amount.

o Check to see if the left car reached (collided with) the Prop object (Hint: use built-in isCollidingWith method). If so:

 Have that car say that it won the race.

 Reset the Boolean flag so that the loop will exit Otherwise, do nothing and continue with the next check.

o Check to see if the right car reached (collided with) the Prop object.

If so:

 Check to see if the left car also reached the prop object (i.e. the boolean was reset already).

If so:

o Have that car say that the other car did not win, but they tied instead.

Otherwise:

o Have that car say it won the race.

o Reset the Boolean flag so that the loop will exit Otherwise (right car has not reached Prop), do nothing and loop. This loop should run until one (or both) car(s) reaches (collides with) the Prop object.

Note that you can test all possibilities for this loop by adjusting the move factor entered in Scene 2 to make each possibility occur. Make sure the duration of each movement in your animation is long enough to view comfortably. Run, test, and debug your Alice program, until it works correctly.

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more