Question: Task03: Modified problem E4.10 from the Book. Create a class called CarSimulator. You will need three instance variables to store: - The number of gallons

 Task03: Modified problem E4.10 from the Book. Create a class called

Task03: Modified problem E4.10 from the Book. Create a class called CarSimulator. You will need three instance variables to store: - The number of gallons of gas in the tank - The fuel efficiency in miles per gallon - The price of gas per gallon Create the following methods: - getCostper100Miles () - the cost to drive 100 miles - getdistance () - how far the car can go with the gas in the tank In your main method for your tester class insert code to prompt the user to enter values for the instance variables described above. Then use the Scanner object created in task02 to read in these values. You will then create a CarSimulator object using these values provided by the user. Finally, test the methods you created for this task. Use printf to limit the number of decimal places in your printouts. You do not need to print expected values. For your input values use 25 gallons in the tank, fuel efficiency of 26.35MPG, and $2.13 cost per gallon

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!