Question: Write a Java program public class Car public static void main(String) args) Car car new Car ) car.driveForward (Sacramento,100) car.park) car.driveForward (Davis,15) car.parko void driveForward

Write a Java program

Write a Java program public class Car public static void main(String) args)

public class Car public static void main(String) args) Car car new Car ) car.driveForward ("Sacramento",100) car.park) car.driveForward ("Davis,15) car.parko void driveForward (String towhere, int miles) System.out.printin ("Driving to " + towhere + " miles+"miles away") void parkO System.out.printin ("Parking the car") 1.Add a constructor that sets the type of car, a name for the car, and its initial location (and also sets the following defaults: that the car is parked; 2.Track where the car is, how far it has been driven, whether it is parked 3.Override toString to return ALL stored information about the car 4.Extras 1.Set how much fuel is in the car and how many miles per gallon it gets; then use fuel while you drive and add a method to fill the car with gas. 2.Instantiate a couple cars and track them in a static ArrayList of Cars

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!