Computers and Technology
Computers and Technology, 17.10.2019 17:30, ashanty45

Write a class named car that represents a car. your car class should have the followning: 1. instance variablesi. make and model of the carii. color of the cariii. the car's priceiv. the car's mileage (total miles traveled, not miles per gallon)2. two overloaded constructorsi. a constructor that takes no parameters. this constructor should set the mileage to 0 and set some default values (use whatever you want ) for the make, model, color and price. ii. a constructor that allows you to set values for the make, model, color and price. this constructor should also set the mileage to 0.3. methodspublic void setprice(double p)this should update the instance variable for price with the specified value. public void paint(string c)this should "paint " the car by changing the instance variable for color with the specified value. public void displaycarinfo()this should display all available information on the car, including its make, model, coor, price, and mileage. public void travel(double distance)this should display a message saying that the car is traveling for the specified distance. this method should also increase the value of the mileage attribute accordingly. after the car class, write a separate client program containing a main method that does the following actions: 1. create two new car objects: a black porsche cayman s with a price of $ 63,800, and a blue nissan leaf with a price of $ 28,800.2. display information for each object by calling its displaycarinfo method.3. paint the cayman purple and the leaf green.4. make the cayman travel 12,000 miles and the leaf 8,000 miles.5. change the price of the cayman to $50,000 and the price of the leaf to $ 24,500.6. call displaycarinfo on each object again to see how the instance variables have changed.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:00, olorteguimikie
Which part of the cpu accepts data?
Answers: 1
image
Computers and Technology, 25.06.2019 06:00, Andy769
Shaniya has misspelled a scientific name in her biology report. she needs to correct it, but she has no access to a computer. she plans to use the word app on her phone without an office 365 subscription. can shaniya correct her mistake? why or why not? yes, she can navigate the window and do simple editing. yes, she can use this application for free and navigate the window. no, her document is “read-only,” so she cannot navigate the window. no, her application has limited features and she cannot access the documen
Answers: 1
image
Computers and Technology, 25.06.2019 09:30, jhahn001
Which of the following is a reason to include the people who will be using the new technology in conversations about technology upgrades for a business? a. the users would likely know if an upgrade would be necessary or even useful. b. the users would know more about the software than people in the it department. c. the users will be paying for the upgrades with their own money. d. the users will assume the upgrade will cause a drop in productivity.
Answers: 1
image
Computers and Technology, 26.06.2019 02:00, Kazya4
List the seven steps in the decision-making process
Answers: 1
Do you know the correct answer?
Write a class named car that represents a car. your car class should have the followning: 1. instanc...

Questions in other subjects:

Konu
Mathematics, 04.02.2020 13:48
Konu
Mathematics, 04.02.2020 13:48
Konu
Mathematics, 04.02.2020 13:48
Konu
Mathematics, 04.02.2020 13:48