subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word β€œforeshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
You know the right answer?
Write a class named car that represents a car. your car class should have the followning: 1. instanc...
Questions
question
Mathematics, 02.03.2020 22:50
question
Computers and Technology, 02.03.2020 22:50
question
Mathematics, 02.03.2020 22:50
Questions on the website: 13722363