subject

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), getPurchase Price(), and to output the car's information (printinfo(). Ex: If the input is: 2011 18000 2018 where 2011 is the car's model year, 18000 is the purchase price, and 2018 is the current year, the output is: Car's information: Model year: 2011 Purchase price: 18000 Current value: 5770 Note: printinfo() should use three spaces for indentation. LAB ACTIVITY 7.26.1: LAB: Car value (classes) 0 / 10 File is marked as read only Current file: CarValue. java 1 import java. util. Scanner; 2 import java. lang. Math; public class CarValue { public static void main(String[] args) { Scanner scnr = new Scanner(System. in); Car myCar = new Car(); int userYear = scnr. nextInt(); int userPrice = scnr. nextInt(); int userCurrent Year = scnr. nextInt(); myCar. setModelYear(userYear); myCar. set PurchasePrice(userPrice); myCar. calcCurrentValue(userCurrentYear); myCar. printInfo(); Current file: Car. java Load default template... public class Car { private int model Year; // TODO: Declare purchasePrice field (int) private int currentValue; public void setModelYear(int userYear) { model Year = userYear; } public int getModel Year() { return model Year; // TODO: Define setPurchasePrice() method // TODO: Define getPurchasePrice() method public void calcCurrentValue(int currentYear) { Current file: Car. java Load default template... return model Year; // TODO: Define setPurchasePrice() method // TODO: Define getPurchasePrice() method public void calcCurrentValue(int currentYear) { double depreciation Rate = 0.15; int carAge = currentYear - model Year; // Car depreciation formula currentValue = (int) Math. round(purchasePrice * Math. pow((1 - depreciationRate), carAge)); // TODO: Define printInfo() method to output model Year, purchasePrice, and currentValue

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 16:10
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
You know the right answer?
LAB: Car value (classes) Given main(), complete the Car class (in file Car. java) with methods to se...
Questions
question
Advanced Placement (AP), 25.02.2021 02:00
question
Mathematics, 25.02.2021 02:00
question
Mathematics, 25.02.2021 02:00
Questions on the website: 13722363