Race Cars"
Construct a calli ng class and a Car class as follows:-' Car Class:-'
Properties: Ma ke (String), Year(int), Color(String), Speed (int)-' Methods: "
Calling Class-'
Create an array of 10 cars. Give them random colors and makes your choice. Select a random year for a car, but when done, half the cars should have a year >=2010. Initial Speed is zero.-' Do the following 100 times-'
After the loop, print out the card number, year, make, color and final speed."
Extra Credit {2 point:}-'
Simulate a race. Each car starts at zero. Make a loop where the body of the loop does the three bullet points above. However, in this part, each iteration of the loop represents one minute of time. After each iteration of the loop, calculate the distance traveled by car. Keep track of each car's total distance. When a car reaches 100 miles, it is the winner. Print out the winning car, the second place car (based on distance) and distance,.....till the last place car.-'
Get Free Quote!
312 Experts Online