Question: Write a java program that creates a class Car . Class Car contains the following private member fields: make, model, year, and miles. The class
Write a java program that creates a class Car. Class Car contains the following private member fields: make, model, year, and miles. The class Car has a constructor that takes as arguments the car make, model, and year. In addition, the constructor sets miles to 100 as default. Class Car has accessors and mutators to get and set the make, model, year and miles on the car. The program should complete the following tasks:
- Ask the user to enter make, model, and year for a car creating an object.
- Display back the make, model, year, and default miles for the car using accessor methods.
- Ask the user to enter the new miles (e.g. 50,000).
- Display the new miles using accessor method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
