Computers and Technology

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:40, Bgreene2377
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
image
Computers and Technology, 23.06.2019 01:50, rhonda45801
Free points just awnser this. what should i watch on netflix
Answers: 2
image
Computers and Technology, 23.06.2019 15:20, headshotplayzcod
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, CalCDanG
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
Do you know the correct answer?
LAB: Car value (classes) Given main(), complete the Car class (in file Car. java) with methods to se...

Questions in other subjects:

Konu
Mathematics, 20.04.2020 22:10
Konu
Chemistry, 20.04.2020 22:11
Konu
English, 20.04.2020 22:11