Computer Science, asked by vaibhavrajput0494, 1 month ago


Define a class named laptop with the following specifications. A digital shop
announces seasonal discount on the laptops in the given order:
Data members -
int cost - to store the cost of the laptop
String brand - to store the brand of the laptop
double dis – to calculate discount
double tot_amt – to store the final amount after discount
Member methods -
void getdata() - to input the cost of the laptop
laptop() - default constructor to initialize the members of the class
Pparameterized constructor – to initialize cost and brand of the laptop.
void compute() – to calculate discount and final amount as per the given
criteria.
Cost of the laptop
Discount
Rs 20,000 - Rs 30,000
10%
Rs 30,001 - Rs 40,000
15%
Rs 40,001 - Rs 50,000
18%
> Rs 50,000
20%
An additional discount of 5% on all types of laptop is given.
Sales tax is also calculated at 12% on the price after discounts.
void print() – to display total amount to be paid by the customer and brand
name of the laptop.
Create method main() to call all the above mentioned methods.
[15]​

Answers

Answered by llDivinell
1

Answer:

Define a class named laptop with the following specifications. A digital shop

announces seasonal discount on the laptops in the given order:

Data members -

int cost - to store the cost of the laptop

String brand - to store the brand of the laptop

double dis – to calculate discount

double tot_amt – to store the final amount after discount

Member methods -

void getdata() - to input the cost of the laptop

laptop() - default constructor to initialize the members of the class

Pparameterized constructor – to initialize cost and brand of the laptop.

void compute() – to calculate discount and final amount as per the given

criteria.

Cost of the laptop

Discount

Rs 20,000 - Rs 30,000

10%

Rs 30,001 - Rs 40,000

15%

Rs 40,001 - Rs 50,000

18%

> Rs 50,000

20%

An additional discount of 5% on all types of laptop is given.

Sales tax is also calculated at 12% on the price after discounts.

void print() – to display total amount to be paid by the customer and brand

name of the laptop.

Create method main() to call all the above mentioned methods.

[15]

Similar questions