Given main(), complete the Car class (in file Car.java) with methods to set and get the purchase price of a car (setPurchasePrice(), getPurchasePrice()), and to output the car's information (printInfo()).
Ex: If the input is:_______.
2011
18000
2018

Answers

Answer 1

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);

   }

}


Related Questions

Any suggestions on how to write the following Python code?


1. Write a Python code to save the following list in a CSV file

ls = [“Hello”, “Hi”, “bye”]

2.Write a Python to read the CSV file generated in the previous step (1) to a Python list.

Help would be much appreciated.

Answers

Answer:

Hi

Explanation:

Write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function should takes one parameter: a list of values (value_list) of various types. The recommended approach for this:

a. create a variable to hold the current sum and initialize it to zero.
b. use a for loop to process each element of the list.
c. test each element to see if it is an integer or a float, and, if so, add its value to the current sum.
d. return the sum at the end.

Answers

In python 3.8:

def func(value_list):

   lst = [x for x in value_list if type(x) == int or type(x) == float]

   return sum(lst)

print(func(["h", "w", 32, 342.23, 'j']))

This is one solution using list comprehensions. I prefer this route because the code is concise.

def func(value_list):

   total = 0

   for x in value_list:

       if type(x) == int or type(x) == float:

           total += x

   return total

print(func(["h", "w", 32, 342.23, 'j']))

This is the way as described in your problem.

What is the difference between a spreadsheet and word processing software?

Only one can calculate numeric data.
Only one can display graphs and charts.
Only one can organize data.
Only one can present text and numeric data.

Answers

Answer:

Only one can calculate numeric data.

Explanation:

Both spreadsheet and word processing software can display graphs and chats.

Both spreadsheet and word processing software can organize data through cells and tables respectively.

Both spreadsheet and word processing software can present text and numeric data.

Answer:

Only one can calculate numeric data.

Explanation:

Help I’ll mark you brainly!

Answers

1. shapes

2. Shapes are classified and have a certain look. Forms are mostly organic and don't have a specific form.

3. value and depth

4. yellow, blue, red

5. orange, green, purple

6. opposite each other

7. right next to each other

9. tint-lightness  shade - darkness

10. value

Have a great day!

~PumpkinSpice1

P.S.~ I take Digital arts so I know all the answers :) I just finished my color unit.

What is the extension of Qbasic ?​

Answers

Answer:

bas

Explanation:

which best explains the relationship among these three facts question 8

Answers

Answer:

no attachment

Explanation:

What is the capacity of a disk with two platters, 10,000 cylinders, an average of 400 sectors per track, and 512 bytes per sector?
What is the use of cache memory? Explain the concepts of cache hit and cache miss.

Answers

Answer:

The capacity of the disk is "40 GB".

Explanation:

Given value:

[tex]\to \text{cylinder}= 10,000\\\\\to \frac{sector}{track} = 400\\\\\to \frac{bytes}{sector} = 512\\[/tex]

[tex]\text{Calculating the size of track} = \frac{bytes}{sector} \times \frac{sector}{track}[/tex]

                                            [tex]= 512 \times 400 \\\\ = 204,800 \ \ Or \ \ 200 \ K[/tex]

[tex]\text{Calculating the size of surface} = \frac{byte}{track} \times \ cylinder[/tex]

                                               [tex]= 2000 \ K \times 10,000 \\\\ = 20, 000,000 \ K[/tex]

[tex]\text{Calculating the capacity of a disk} = \frac{byte}{surface} \times \frac{surface}{disk}[/tex]

                                                     [tex]= 20, 000,000 \ K \times 2 \\\\ = 40, 000,000 \ K \\\\= 40 \ GB[/tex]

Cache memory is often used to speed up the runtime. It will enable us to improve performance unless we can store information, that is retrieved constantly in memory space.

Hit Cache: when the Processor relates to representing database data, Cache Hit results. Miss Cache: when this Processor responds to a non-present cache data, this will trigger its miss of cache.It doesn't have to retrieve the Main Memory through secondary storage.

Range is an example of a ______________.

Answers

Answer:

example in ( 4,6,9,3,7) lowest value is 3and highest is 9.

How goes design again ones attention?

Answers

Answer:

the only thing i could think of is creating a different way to get someone to pay attention to you like maybe instead of shouting or tapping on ones shoulder maybe try to ask the person closest to them to get their attention for you. or by doing something extremely impressive or distracting

Explanation:


Martin is responsible for translating the script into a visual form by creating a storyboard. Which role is he playing?
Martin is playing the role of a(n)

Answers

Answer:

The correct answer to this question is given below in the explanation section.

Explanation:

The question is about to  identify the role of Martin, who converts script into visual form by creating a storyboard.

The correct answer to this question is:

Martin is playing the role of Production Design and he is working at the position of the production designer.

Before shooting a film, the production designer is the first artist who converts script into a visual form such as creating storyboards. And, that storyboard serves as the first film draft.

A storyboard is a series of sketches, paintings, etc arranged on a panel to show the visual progress of the story from one scene to the next.   These storyboards are used from start to finish of the film. Because these storyboards or sketches serve as the visual guide for the director of the film throughout the production.  

Answer:

Hi

Explanation:

THE ANSWER UP TOP IS WRONG LIKE DEAD WRONG

Suppose that one of the following control signals in the single-cycle MIPS processor has a stuck-at-0 fault, meaning that the signal is always O, regardless of its intended value. What instructions would malfunction? Why? (a) RegWrite (b) ALUOp1 (c) MemWrite Repeat for all three signals (a) to (c) above, assuming that the signal has a stuck-at-1 fault.

Answers

Answer:

Explanation:

RegWrite:

• All R-type instructions, lw and addi:

• The result of the operation/load/addition would not be written back to the destination register

• ALUOP

• The following R-type instructions: add, sub, and, or, slt

• With ALUOp stuck at 0, the ALU decoder would interpret all those instructions as either add or subtract operations. The ALUOp gets decoded to add or subtract depending on ALUOp[0].

• MemWrite:

• Only sw is affected.

• The memory write won’t take place.

express cards functionalities​

Answers

Answer:

ExpressCard, initially called NEWCARD, is an interface to connect peripheral devices to a computer, usually a laptop computer. The ExpressCard technical standard specifies the design of slots built into the computer and of expansion cards to insert in the slots.

Which kind of storage has a spinning platter?

magnetic hard disk

O server

O solid state hard disk

O cloud

Answers

Answer:

Magnetic hard disk

Explanation:

The type of storage that has a spinning platter is called MAGNETIC HARD DISK reason been that MAGNETIC HARD DISK are made up of one or more disks that are been covered with a magnetic coasting or magnetic material to help store information or data permanently on a desktop or a computer and lastly this type of disks help to read data and as well write and rewrite data.

Right now I have an i5 2400 and a PYN XLR8 gaming GTX 1650 Super, my CPU is too weak for 1080p gaming, what CPU should I get that has a B75 LGA 1155 socket, or Overclock it if so how many GHz should I overclock it to
(I only have a stock cooler)

Answers

Answer:

if its a number you need 5600GHz but im not to sure

Explanation:

Answer:

answer

Explanation:

if it a number you need 5600GHz but it not I'm not sure

Which traits are common in all four career pathways of the Information Technology field? Check all that apply.

A)accuracy and attention to detail
B)problem-solving and critical-thinking skills
C)knowledge of programming language
D)ability to work independently
E)ability to protect confidential information
F)ability to learn quickly

Answers

I would say all of the above

Answer:

Abcd

Explanation:

What is output?

C = 1
sum - 0
while (c < 10):
c = c + 3
sum = sum + c

print (sum)​

Answers

11

Explanation:

Please make me Brainliest

You are troubleshooting an issue where a PC can reach some hosts on the Internet (using either DNS name or IP address), while several other hosts on the Internet are not reachable. From the PC you can Ping all devices on your local subnet. What is most likely causing the problem?

Answers

The options are missing from the question,below are the options to choose from;

A) incorrect (or missing) routes in a routers routing table

B) incorrect DNS configuration on the PC

C) incorrect default gateway configuration on the PC

D) duplicate IP addresses on your LAN

Answer: The correct answer to the question is option A

INCORRECT (OR MISSING) ROUTES IN A ROUTERS ROUTING TABLE.

Explanation: When it is possible for a PC to ping some devices but not actually all,we can then make an assumption that either it has a wrong subnet that is configured or the router from the path to the remote device actually has an incorrect or a missing routes to the device.

Using Python Write an expression using Boolean operators that prints "Special number" if special_num is -99, 0, or 44.

Sample output with input: 17
Not special number

Answers

special_num = int(input())

if special_num == -99 or special_num == 0 or special_num == 44:

   print("Special number")

else:

   print("Not special number")

I wrote the code so that the user enters a number of their choice. Best of luck.

PLS HELP IF U KNOW A LOT ABT SOCIAL MEDIA

Idk what’s going on with Pinterest but I can’t follow ppl, dm ppl or comment on stuff and it says an error (attached image) what can I do to fix this? Also I’ve tried logging in and out and I’ve tried deleting the app. Btw it’s on a business account

Answers

Answer:

Its probably your computer

Explanation:

Try restarting, shutting down and starting back up your computer/laptop. Or just move to a different device.

In order to make schemas that will appear in the Schema Library available in the XML Options dialog box, what file extension should a user give to schemas?

--.xml
--.xsl
--.xslt
--.xsd

Answers

Answer:

You can use your XML parser

Explanation:

hope this helps!

While working on a customer issue, your colleague calls and asks for help to resolve his issue. What should you do?A. Go ahead and resolve his situation first B. Request the colleague to call after sometime C. Work on both the issues at the same time D. Tell your colleague to work on his own.

Answers

Answer:

Request the colleague to call after sometime

Explanation:

While working on a customer issue, your colleague calls and asks for help to resolve his issue. What should be done is to "Request the colleague to call after some time."

This is because,e in situations like that, it is believed that the customer should come first, and that is the purpose of being there. For employee to serve the customer. A colleague can easily link up with other employees to get his issues sorted, or simply wait.

This elementary problem begins to explore propagation delay and transmis- sion delay, two central concepts in data networking. Consider two hosts, A and B, connected by a single link of rate R bps. Suppose that the two hosts are separated by m meters, and suppose the propagation speed along the link is s meters/sec. Host A is to send a packet of size L bits to Host B

a. Express the propagation delay, dprops in terms of m and s

b. Determine the transmission time of the packet, drans, in terms of L and R.

c. Ignoring processing and queuing delays, obtain an expression for the end-

d. Suppose Host A begins to transmit the packet at time t = 0. At time t = dtrans'

e. Suppose drop is greater than dran . At time t = d, ans, where is the first bit of

f. Suppose dprop is less than dtrans. At time t = dtrans, where is the first bit of

g. Suppose s = 2.5-108, L = 120 bits, and R = 56 kbps. Find the distance m so that dprop equals drans

Answers

Answer:

A. dprops = m /s seconds.

B. drans = L / R seconds.

C.  delay(end −to−end) =  (m /s + L / R) seconds.

D. The bit has just been sent to Host B or just left Host A.

E. The first bit is in the link and has not reached Host B.

F. The first bit has reached Host B.

G. m = 535.714 km.

Explanation:

The transmission time or delay of packets in a network medium is the packet size L, divided by the bit rate R (in seconds). The propagation time or delay is the ratio of the distance or length of the transmission cable, m, and the propagation speed of the cable, S (in seconds).

The end-to-end delay or the Packet delivery time is the total delay in transmission, which is the sum of the propagation delay and the transmission delay.

To get the distance where the propagation delay is equal to the transmission delay;

distance (m) = L /R  

= (120/56 ×10^3) 2.5 ×10^8   = 535.714 km

How does natural gas move through pipelines from the well head to the end user thousands of miles away

Answers

It’s the large compressors that are pumping and working together through the different stations ... They move the gas through the pipelines which they’re under high pressure.

The single-cycle datapath conceptually described in this section must have separate instruction and data memories, because:________. a. the formats of data and instructions are diff erent in MIPS, and hence different memories are needed. b. having separate memories is less expensive. c. the processor operates in one cycle and cannot use a single-ported memory for two different accesses within that cycled. the formats of data and instructions are different in MIPS, and hence different R-type instructions are needed .

Answers

Answer:

C. The processor operates in one cycle and cannot use a single-ported memory for two different accesses within that cycle

Explanation:

Processors require instructions and data which are retrieved from data memories for processing, but it cannot access two or receive two both processes as only a port is used for accessing data and another for receiving instructions. In fact, a single-cycle or single-clock processor cannot use a resource more than once.

_decisions are more common at lower organizational levels

Answers

Which of the following is not a characteristic of a structured decision?

The first three phases of the decision-making process need not occur in any particular sequence.

Structured

________ decisions are more common at lower organizational levels.

Operational control

_____ is the efficient and effective execution of specific tasks.

unstructured

When there is no well-understood or agreed-on procedure for making a decision, the decision is said to be:

Users didn't have the right tools to access the data.

Refer to the Opening Case - Quality Assurance at Daimler AG: Which of the following best describes Daimler's Quality Information System (QUIS)?

digital dashboards

Which of the following information systems are very user friendly, supported by graphics, and provide exception reporting and drill down?

The number of alternatives is decreasing.

Which of the following is not a reason why managers need IT support?

implementation

Success in the _____ phase of the decision-making process results in resolving the original problem, and failure leads to a return to previous phases.

interpersonal

Being a figurehead and leader is part of the _____ managerial role.

how is the information technology Career Cluster different from the others clusters?

Answers

Answer:

All career clusters use information technology in carrying out their work.

Explanation:

How is the Information Technology career cluster different from most other clusters?

All career clusters use information technology in carrying out their work.

I saw this on quizlet, hope this helps!

Write a function that converts a string into an int. Assume the int is between 10 and 99. Do not use the atoi() or the stoi() function.

Answers

Answer:

Written in C++

#include <iostream>

#include <sstream>

using namespace std;

int main()  {

   string num;

   cout<<"Enter a number: ";

   cin>>num;

   stringstream sstream(num);

   int convertnum = 0;

   sstream >> convertnum;

   cout << "Output: " << convertnum;

}

Explanation:

Without using atoi() or stoi(), we can make use of a string stream and this is explained as follows:

This line declares a string variable num

   string num;

This line prompts user for input

   cout<<"Enter a number: ";

This line gets user input

   cin>>num;

This line declares a string stream variable, sstream

   stringstream sstream(num);

This line declares and initializes the output variable, convertnum to 0

   int convertnum = 0;

The stream is passed into the output variable, convertnum

   sstream >> convertnum;

This line displays the output

   cout << "Output: " << convertnum;

Note that: if user enters a non integer character such as (alphabet, etc), only the integer part will be convert.

For instance,

40a will be outputted as 40

Please help I don’t know

Answers

Answer: Go down 1 time, then to the left 3 times, then down 1, finally, go left 1 time.

Explanation:

Looking at the response vehicles (pictured above), explain two options you have in order to abide by the Move Over law,

Answers

Answer: two options I have in order to abide by the move over law is to either move over or slow down. You must move over a lane away from stationary emergency vehicles if it is safe to do so. If it is not safe to do so then the driver must proceed with due caution, with a safe speed for road conditions.Until the driver has passed the emergency vehicle.

Explanation:Let me know if this helped! (:

Answer:

two possible options in order to abide by the move over law would be to either move over to a different lane (one lane away or more) or slow down.

Explanation:

What are the ten main components of a report that would be delivered at the end of a data science project?

Answers

Answer:

The answer is below

Explanation:

The ten main components of a report that would be delivered at the end of a data science project are the following:

1. Cover page: the involves elements such as the title of the project, the name of the author, name of institution, date of publication

2. Table of Contents: this comprised information like chapters, topics, and subtopics

3. Abstract: a summary of the whole project

4. Introductory Section: a brief background study

5. Methodology section: this describes the methods used in gathering and analyzing the data

6. Data section: this shows the data gathered for the project. It is mostly represented in tables, histograms, pie charts, etc.

7. Analysis section: this describes what was analyzed

8. Result section: this described the outcome of the analysis

9. Conclusion section: this describes the whole outcome of the data project and what the author derived or concluded.

10. References: this describes the information about the works of other authors, the author used in building his background knowledge towards his data science project.

Other Questions
Name 3 sources of carbohydrates for the production of an alcoholic drink Please help thank you Once blood delivers oxygen, what does it pick up from cells on its way back to the heart?nutrientsnitrogencarbon dioxide what's your favorite color. will give brainlest if we have the same. just trying to give people easy ways to get points In which orbitals would the valence electrons for selenium (Se) be placed? HELPPPPPPPPP ASAPPPPPPPP PLSSSS Write a character sketch for your protagonist in your Module One short story. Include literal, interpretive, and evaluative information. Your character sketch should be 35 complete sentences and include at least three specific details from the text to support your character analysis. (My story is Rules of the game by Amy tan.) 15 points for answer and brainliest answer for correct answer. Question up above why does the constitution divide power among branches of government? please please help me in this question Please help! Step by step explanation, Graph the step function over the interval For a new customer, a video store charges $10 for a rental card plus $2 per movie. Using the linear equation (y=mx+b) you wrote, find the cost for a new customer to rent 6 movies. Helen has just been diagnosed with hirsutism. Which symptoms does she most likely have?A. hair growth on her face and chestB. an inflamed rash on her backC. spots of baldness on her headD. inflammation of her nail matrix y=4x+3 y=-x -2 I need help please Every 125 pages that Raul reads during his summer reading challenge, he will collect 5 book points to use at his local library. Which graph models a relationship with the same unit rate? When the Mongols invaded lands, what did they allow to remain the same? the term to term rule of a sequence is divide by 2 what does KFC stand for WHAT IS THE SLOPE? !! WILL GIVE BRAINLIEST In what ways did the 1920s represent the benefits of interconnectedness?