Q017 Vehicle Computation Details

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Vehicle Computation Details

Hiroshi car showroom has come up with a new idea of displaying the car details using touch
screen in order to reduce the burden of their staff to explain the details of each car. They want
to build an application where customer can touch the car of their preference and system will
ask some car details and display the same along with any discount applicable on it.

[Note : Strictly adhere to the object-oriented specifications given as a part of the problem
statement.
Follow the naming conventions as mentioned. Create separate classes in separate files.]

Create an interface ICars with the following abstract method.


Method Description
void Display() Display the car details
void DiscountAvailable() Calculate the discount on each car

Consider a class called Cars with the following private member variables
DataType Attributes
string milage
string color
double price
int totalSeat

Include appropriate getters and setters.


Include default and parameterized constructor for the class.
Prototype for the Parameterized Constructor Cars(string _milage, string _color, double _price,
int _totalSeat)

Create another class called Hyundai with the following private member variables which
implements the ICars interface and Cars class
DataType Attributes
string milage
string color
double price
int totalSeat

Include appropriate getters and setters.


Include default and parameterized constructor for the class.
Use base keyword for constructor invocation of base class
Implement the abstract method of ICars in the class Hyundai which should calculate the
discount and display the details of the car.
Provide 1.5% discount on total cost of car.
Create another class called Toyota with the following private member variables which
implements the ICars interface and Cars class
DataType Attributes
string milage
string color
double price
int totalSeat

Include appropriate getters and setters.


Include default and parameterized constructor for the class.
Use base keyword for constructor invocation of base class
Implement the abstract method of ICars in the class Toyota which should calculate the discount
and display the details of the car.
Provide 2.5% discount on total cost of car.

Create another class called RangeRover with the following private member variables which
implements the ICars interface and Cars class
DataType Attributes
string milage
string color
double price
int totalSeat

Include appropriate getters and setters.


Include default and parameterized constructor for the class.
Use base keyword for constructor invocation of base class
Implement the abstract method of ICars in the class RangeRover which should calculate the
discount and display the details of the car.
Provide 3.5% discount on total cost of car.

Consider class Program with Main method to get the details of the Car from the customer and
display the details using the Display() method along with calculative discount price using
DiscountAvailable() method of the respective class. Display “Invalid Choice!!” when user gives
invalid choice of Car.

The link to download the template code is given below


Code Template

Input and Output Format:

Refer sample input and output for formatting specifications.


[All text in bold corresponds to the input and the rest corresponds to output.]

Sample Input and Output 1:


Welcome To Hiroshi Car Showroom
We offer trending cars of different features
Select the car of your preference:
1. Hyundai
2. Toyota
3. RangeRover
1
Enter milage:
20 pmg
Enter color:
Red
Enter price:
3000000
Enter no of seats:
5
Hyundai Details!!
Milage of this car: 20 pmg
Color of this car: Red
Price of this car: 3000000
Total seat in this car: 5
Discount on car 45000
Select the car of your preference:
1. Hyundai
2. Toyota
3. RangeRover
2
Enter milage:
35 pmg
Enter color:
Royal blue
Enter price:
6500000
Enter no of seats:
8
Toyota Details!!
Milage of this car: 35 pmg
Color of this car: Royal blue
Price of this car: 6500000
Total seat in this car: 8
Discount on car 162500
Select the car of your preference:
1. Hyundai
2. Toyota
3. RangeRover
4
Invalid Choice!!

You might also like