ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 05 May 2017 My Price 9.00

Java Program Demonstrating Inheritance

Java Program Demonstrating Inheritance you are writing a program for a car rental company. This company rents more than one type of vehicle to customers and the employees use programs to keep track of the cars for rental.

A Vehicle class that has a VIN (of type string) and gasTank () of type double, properties, a full constructor, and an abstract method called displayDetails() which returns a string.

A Car class that inherits from Vehicle also has a size (of type string) to tell if it is a subcompact, compact, or fullsized car and a full constructor. It should have a method called displayDetails() which returns a string and tells about all of its attributes.

A Truck class that inherits from Vehicle also has a bedSize (of type integer) to how big it is, properties and a full constructor. It should have a method called displayDetails() which returns a string and tells about all of its attributes.

 

Have correct data types and correct access modifiers (public/private/protected) as well as validation for gasTank and bedSize to prevent negative values in these class definitions.

Create a Car object in main() and a truck object in main() to test your newly created class definitions.  

Demonstrating Polymorhism for the car rental company. This company rents more than one type of vehicle to customers and the processes for the organization work with cars and trucks at the same time. Demonstrate how to handle this.

Change the test code in main to have an array of 4 Vehicles.

 

Write a loop that prompts the user 4 times.

The body of the loop should have an If statement asking the user if they are creating a car or a truck. If the user chose a Car it should ask for all of the values for a Car and store one in the next position in the array of vehicles. If it is a truck it should ask for all of the values for a Truck and store one in the next position in the array of vehicles.

After input is complete there should be a polymorphic loop through the array of vehicles that shows the details for all of them to the user with the displayDetails() method.

Answers

(11)
Status NEW Posted 05 May 2017 09:05 AM My Price 9.00

-----------

Attachments

file 1493975114-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)