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

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
Get step-by-step solutions from verified subject matter experts
