Computer Science, asked by TrushnaMurukate, 1 month ago

Define a class Car which has details as below: Data Members: String brand: which accepts the brand of the car (BMW/Mercedes/Rolls Royce) String model: which accepts model of the car (sedan/hatchback/SUV) int no_seats: which accepts seats present in the car String color: which accepts color of the car double price: which accepts price of the car o Member Methods: 1) Car(String,String,int, String, double): a parameterized constructor to initialize the data members. 2) void accept(): Accepts car brand,car model,number of seats in the car, car colour and car price 3) void calculate(): If the car is of brand BMW, customer gets 2.5% discount, if its Mercedes, 5% discount and if Rolls Royce, 3% discount, 4) void display(): To display all the car details along with final price after discount.​

Answers

Answered by nitishkhokhar6
0

Answer:

Define a class Car which has details as below: Data Members: String brand: which accepts the brand of the car (BMW/Mercedes/Rolls Royce) String model: which accepts model of the car (sedan/hatchback/SUV) int no_seats: which accepts seats present in the car String color: which accepts color of the car double price: which accepts price of the car o Member Methods: 1) Car(String,String,int, String, double): a parameterized constructor to initialize the data members. 2) void accept(): Accepts car brand,car model,number of seats in the car, car colour and car price 3) void calculate(): If the car is of brand BMW, customer gets 2.5% discount, if its Mercedes, 5% discount and if Rolls Royce, 3% discount, 4) void display(): To display all the car details along with final price after discount.​

Explanation:

Similar questions