Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 CarsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started