1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
WINSTONCH [101]
3 years ago
14

Given main(), complete the Car class (in file Car.java) with methods to set and get the purchase price of a car (setPurchasePric

e(), getPurchasePrice()), and to output the car's information (printInfo()).
Ex: If the input is:_______.
2011
18000
2018
Computers and Technology
1 answer:
Amiraneli [1.4K]3 years ago
8 0

Answer:

Explanation:

This a java code for a car and can be written as follows:

public class Car {

   private int modelYear;

   private int purchasePrice;

   private int currentValue;

   public int getModelYear() {

       return modelYear;

   }

   public void setModelYear(int modelYear) {

       this.modelYear = modelYear;

   }

   public int getPurchasePrice() {

       return purchasePrice;

   }

   public void setPurchasePrice(int purchasePrice) {

       this.purchasePrice = purchasePrice;

   }

   public int getCurrentValue() {

       return currentValue;

   }

   public void calcCurrentValue(int year) {

       int age = year - modelYear;

       currentValue = (int) Math.round(purchasePrice * Math.pow(0.85, age));

   }

   public void printInfo() {

       System.out.println("Car's information:");

       System.out.println("   Model year: " + modelYear);

       System.out.println("   Purchase price: " + purchasePrice);

       System.out.println("   Current value: " + currentValue);

   }

}

You might be interested in
Match the feature to its function.
kolbaska11 [484]

Answer:

Match the feature to its function.  The answers are as below:

1. Normal view the place where creating and editing occurs  

2. Notes view an area in which information for handouts can be added  

3. Slide pane the place where the slide order can be changed

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks  

Explanation:

It is the normal view where the editing and the creation of the slides occur. And it's the notes view where you can add the information for handouts. You can arrange the slides in the slide pane. And you can get a list of commands for creating the presentation in the Menu bar. Also, Toolbar is the rows of icons which helps in performing a various set of tasks. And all these are definitions and prove our above selections are correct.

6 0
3 years ago
A student should always read the directions to a test or question so they know what is expected of them when answering the quest
Kay [80]

I don't know why you needed to ask this but the answer is True

7 0
3 years ago
Read 2 more answers
What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java?
Inessa05 [86]

Answer:

java: error

C: false

Explanation:

In Java the compiler understand that you are trying to compare an integer (15) with a boolean (10 > 5) this generate the next error:

error: bad operand types for binary operator  

In C the compiler convert (15 > 10 > 5) in (15>10) > (10>5) which is equal to TRUE > TRUE, the compiler can also read it as 1 > 1 (since 1 is TRUE and 0 is FALSE).  like 1>1 is false then C program return false.

5 0
3 years ago
What should you do to help prepare yourself for the delivery of your presentation? you can chose more then one
Lubov Fominskaja [6]
1 makes sense for somewhere you haven't been before. 2 could be interesting, but it's a bit superfluous if not required. 3 is the most important and essential. Some teachers don't want presenters to look at the board/read their slides word for word when they present, so it might be a good idea to have note cards instead.

Hope this helps!
4 0
3 years ago
Is iPhone better than android
andriy [413]

Answer:

It's up to personal preference.

Explanation:

iPhone/Apple gives more compliments to security than Android.

Android has more friendly user GUI and dev tools.

4 0
3 years ago
Read 2 more answers
Other questions:
  • A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
    11·2 answers
  • A(n) ____ database is an application appropriate for an object-oriented database that contains text links to other types of docu
    7·1 answer
  • A person who has a been exposed to technology at a young age is?
    8·1 answer
  • List five ways in which the type declaration system of a language such as Java or C differs from the data definition language us
    8·1 answer
  • Assume you need to test a function named max. The function max receives two int arguments and returns the larger. Write the defi
    6·1 answer
  • What are some “creatures/animals” that Rex imitates?
    14·1 answer
  • What is blockchain? How it works? I heard bitcoin uses it.
    8·1 answer
  • Searching for a particular record in a database is called “querying the data.”<br> True<br> False
    9·2 answers
  • ¿Qué diferencia existe entre un virus biológico y virus informático?
    12·1 answer
  • Q5: what is the difference between a spreadsheet and a relational database? when would you have to use a relational database ins
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!