The high school driving instructor wants to predict where students on the driving course are. The course is an oval with three segments, each 1 mile long. Each segment has a different speed limit: 20 mph, 60 mph, and 30 mph respectively. Our driver starts at zero mph at the start of the first segment and accelerates (at 15f/s/s, or 10.23mph/s) up to 20mph. At the start of the second segment, our driver accelerates again to 60 mph. Our driver slows down so that she is driving 30mph at the start of the third segment. Write a program that prints the location (distance from start), speed, and time every 30 seconds for each of three cars starting 1 minute apart based on this model. Report speed and location in miles/hour and miles.
Your output should look something like
Time | car A | car B | car C | |||
speed | location | speed | location | speed | location | |
0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
30.0 | 20.0 | 0.16 | 0.0 | 0.0 | 0.0 | 0.0 |
... |
Create a class Car. Create an instance of this class for each car on the course. Your main in the Car class should produce the output for the three cars given above. (That is, I should be able to compile and run your Car.java code, and without further input, the table will be generated.)