Question: Java// please use the code provided!! I attached a photo. Thank you. 7.24 LAB: Car value (classes) Given main . complete the Car class (in

Java// please use the code provided!! I attached a photo. Thank you.
Java// please use the code provided!! I attached a photo. Thank you.
7.24 LAB: Car value (classes) Given main . complete the Car class
(in file Carjava) with methods to set and get the purchase price

7.24 LAB: Car value (classes) Given main . complete the Car class (in file Carjava) with methods to set and get the purchase price of a car (setPurchasePricee. getPurchasePrice0), and to output the car's information (printinfo0). Exif the ingut is: 2011180002018 Where 2017 is the car's model year, 18000 is the purchase price, and 2018 is the current yeac, the output is: Carts information: Model year: 2011 Purchase pricet $18000 Curtent value: $5770 Note printinfo0 should use two spaces for indentation. File is marked as read only. Current fule: CarValue.j public class Car \{t private int modelyear; II TOD0: Declare purchasePrice field (int) private int currentValue; public void setModelYear(int userYear) \{ modelYear = userYear; \} public int getModelYear( \& return modelYear; 3 1/ TOOO: Define setPurchaseprice() method 1/ TODO: Define getPurchasePrice() method public void calcCurrentValue(int currentYear) \{ double depreciationRate =0.15; int carAge - currentYear - modelYear; 1/ Car depreciation formula currentValue = (int) Math. round(purchasePrice * Math. pow((1 - depreciationRate), carAge)); 3 1/ TODO: Define printInfo() method to output modelYear, purchaseprice, and currentValue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!