Question: 3 3 . 2 4 LAB: Car value ( classes ) Given main ( ) , complete the car class ( in file Car.java )
LAB: Car value classes
Given main complete the car class in file Car.java with methods to set and get the purchase price of a car setPurchasePrice
getPurchasePrice and to output the car's information printlnfo
Ex: If the input is:
where is the car's model year, is the purchase price, and is the current year, the output is:
Car's information:
Model year:
Purchase price: $
Current value: $
Note: printinfo should use two spaces for indentation.
File is marked as read only
public static void mainString args
Scanner scnr new Scanner
System.in;
Car myCar new Car;
int useryear scnr nextInt;
int userPrice scnrnextInt;
int userCurrentYear scnrnextInt;
myCar.setModelYearuserYear;
myCar.setPurchasePriceuserPrice;
mycar.calcCurrentValueuserCurrentYear;
myCar.printInfo;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
