Java Write Class Represents Car Car Year Current Mileage Reading Include Appropriate Const Q37074738

Java

Write a class that represents a car.Each car has a year, and a current mileage reading. Include anappropriate constructor, getYear() and getMileage() methods, atoString() method, and anupdateMileage() method that increases the mileage.You only need to provide one constructor, and that constructor musthave two parameters that are used to initialize both data fields.The toString() method must return a string thatcontains the year and mileage in a readable fashion. TheupdateMileage() method should have one parameter,which is the amount to increase the mileage. You arenot expected to write amain method to use/test the class, just create theclass itself.

public class Car

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.