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, 22.06.2019 15:00
The three logical operators used to write compound conditions are "and," "or," and "not." a: true b: false
Answers: 2
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
question
Computers and Technology, 24.06.2019 10:20
Multiple choice project create a program with two multiple choice questions. 1. users have two attempts only, show attempt number each time. hint: while loop with break control. (20%) 2. only one correct answer for each question, use switch case for each question. (20%) 3. show total score after the two questions are answered. hint: . (20%) 4. user have options to answer the two questions again if first attempt score is not 100%. hint: if statment. (20%) 5. use string method .toupper() to allow users to enter with lowercase or uppercase letters. (20%) 1. where is the capital of the state of florida? a. orlando b. tallahassee c. miami d. tampa b 2. where is walt disney world park located in florida? a. orlando b. tallahassee c. miami d. tampa a
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject after the midsemester exams and the end-of-semester exams. she divides the midsemester and end-of-semester information into two separate worksheets, sheet 1 and sheet 2. how will she rename the two worksheets?
Answers: 2
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
Business, 07.11.2020 21:00
question
Business, 07.11.2020 21:00
question
Mathematics, 07.11.2020 21:00
question
Mathematics, 07.11.2020 21:00
question
Mathematics, 07.11.2020 21:00
question
Arts, 07.11.2020 21:00
question
Health, 07.11.2020 21:00
question
Physics, 07.11.2020 21:00
Questions on the website: 13722360