Create alice program that minimally does move the cars

Assignment Help Programming Languages
Reference no: EM131299024

Alice Programming Assignment: Loops

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 size

• 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.

Optionally you may add one or more methods that will use a loop to cause the objects to perform some other behavior more than once.

NOTE: The new behavior cannot be a behavior implemented by any of the course materials.

The method(s) should be invoked from an additional extraCreditScene method.

Warning: Do not attempt to implement the extra credit unless you have first successfully implemented the normal part of the assignment. You will not receive any extra credit if the normal part of the assignment is not functioning properly. Be sure to save a copy of the normal part of the assignment, in case your efforts on the extra credit are unsuccessful.

Reference no: EM131299024

Questions Cloud

Company align organizational and employee goals : In what ways can a company align organizational and employee goals? How can a company ensure that employees are focused on the right goals? (please address both parts)
Create a query with all fields from the student table : Create a query with all fields from the student table, where the student's last name is "Smith". Create a query that includes students' first names, last names, and phone numbers.
Pros and cons of four provider payment methods : Explain the pros and cons of four provider payment methods: (a) fee-for-service; (b) capitation; (c) global capitation; and (d) bundled payment.
Changing landscape of the health care system : Write a 1,050 word reflection that details the changing landscape of the health care system. Include the following:
Create alice program that minimally does move the cars : Create an Alice program that minimally does 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
What was the largest positive monthly return : FIN 301 Excel Exercise: Return and Beta Calculation. What is the most recent month in which the company returns moves in the opposite direction of the S&P 500 return? What was the largest positive monthly return
Company external situation : Thinking strategically about a company's external situation involves probing for answers to the following seven questions: Choose four of the seven questions and submit.
Determine the maximum tolerable input referred noise : Determine the maximum tolerable input-referred noise of the mixers such that the transmitted noise in the GSM RX band does not exceed -155 dBm.
What is market segmentation : Question 1. What is market segmentation? Being a marketing manager, what kind of different bases you will chose for the market segmentation?

Reviews

Write a Review

Programming Languages Questions & Answers

  Do not represent the date as a string show how the given

describe two different ways to represent a birthday register i.e. the names of your friends and their birth dates.

  Write script to inputs five number and finds negative number

Write down the script which inputs five number and finds out and outputs XHTML text which displays number of negative numbers input.

  Pseudocode for linear search by using clrs3e style

Write pseudocode for linear search by using CLRS3e style used in, which scans through the sequence, looking for v.

  Based on the kercher 2009 article how can management tools

q1. based on the kercher 2009 article how can management tools for microsoft windows server 2008 automate user account

  Write a short report on a current game engine

Briefly introduce and discuss a game engine of students own choice. Students are encouraged to explore the concept and discussion of existing technologies which define a game engine.

  Program to display words in a list box sorted by number

Write a program to display the words in a list box sorted by the number of different vowels(a,e,i,o,u) in the word.

  Create a math tutoring program

You are being contracted to create a math tutoring program for a local elementary school.  This tutoring software should ask children which operation they would like to work on

  Create text based or gui menu to perform the given functions

Create a text based or GUI menu to perform the following functions. Create your design in pseudocode and then code a RAPTOR program which generates output to the screenand a text file.

  Writing program of long term parking

Write an enitre program about the long term parking, and calculate the parking total fare.

  Explaining steps to execute branch instruction

Sketch a flow chart which carefully explains steps that little man follows to execute a branch instruction.

  Create class templates for administrative employess

Create classes or class templates for the following: Administrative Employess are paid a salary, but they also receive a bonus at regular intervals during the year.

  Design architecture of system to accept natural language

Using the generic model of a language processing system presented here, design the architecture of a system that accepts natural language commands and translates.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd