Use the Car and RaceCar classes you created in the You Do It section of this chapter, or
create them now. Make the following changes:
a. Add fields to the Car class to hold a Car identification number and the number of miles
the Car has traveled.
b. Add a function to set the Car number. Add a function to increase the miles a Car has
traveled in the last hour. The function adds the current speed (in miles per hour) to the
number of miles traveled. Add a function to return the miles a Car has traveled so you
can display the value.
c. Alter the turnIgnitionOn()function to initialize miles traveled to zero. Alter the
showCar()function to display the newly added Car number and miles traveled in
addition to the other Car data.
1
Expert's answer
2014-03-17T14:03:41-0400
Dear customer, Unfortunately, your question requires a lot of work and cannot be done for free. Please submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment