Em Andamento

Simple Car Program

Your uncle is trying to keep track of his new-car and used-car lots by writing a Java program. He needs your help in setting up his classes.

Implement a superclass named Car that contains a price instance variable, a getPrice method, and a 1-parameter constructor. The getPrice method is a simple accessor method that returns the price instance variable’s value. The 1-parameter constructor receives a cost parameter and assigns a value to the price instance variable based on this formula:

price = cost * 2;

Implement two classes named NewCar and UsedCar; they are both derived from the Car superclass. NewCar should contain a color instance variable (the car’s color). UsedCar should contain a mileage instance variable (the car’s odometer reading). The NewCar and UsedCar classes should each contain a 2-parameter constructor, an equals method, and a display method. In the interest of elegance and maintainability, don’t forget to have your subclass constructors call your superclass constructors when appropriate. The display method should print the values of all the instance variables within its class.

Use [url removed, login to view] in a new window driver class that tests your three car classes.

Output:

price = $16,000.66, color = silver

price = $5,000.00, mileage = 100,000

Submit your [url removed, login to view], [url removed, login to view] and [url removed, login to view] files.

Habilidades: Java

Ver mais: formula writing, car's, used car, help writing program, java program simple, java simple class, java program help, driver program, java program classes, car price, program java files, simple method java, writing car, driver program java, mileage formula, car writing, print car, simple driver, java print method, java car program, car color, program method, classes program, odometer java, java print driver

Acerca do Empregador:
( 1 comentário ) LAYTON, United States

ID do Projeto: #5145762

Premiar a:

urmate

*** Deliver within 1 hour *** Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks

$15 USD em 1 dia
(47 Avaliações)
4.9

4 freelancers estão ofertando em média $19 para este trabalho

rohitagarberg

Hi sir, we have read the complete requirements and will deliver it. thanks................................................

$14 USD em 1 dia
(2 Comentários)
1.6
it2051229

Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my Java skills. I am focused mostly on doing computer science homework here in [url removed, login to view] and I would like Mais

$20 USD in 0 dias
(232 Comentários)
6.3
mindGameX

Greetings!! Although I am a new bee on freelancer but I have 7+ years of work experience with IT MNC's as Java/J2EE developer. I have done projects like security product used on major countries airports, customer c Mais

$25 USD in 2 dias
(1 Comentário)
0.6