Page 289 - CA_Blue( J )_Class10
P. 289
Type of Coaches Amount
First_AC 700
Second_AC 500
Third_AC 250
Sleeper None
void display() : To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.
7. Define a class Discount having the following description:
Class name : Discount
Data member
String item : name of item
double cost : price of item
double dis : discount
double amt : amount to be paid
Member Method
void input() : Enter item name and cost
void cal() : Calculates the discounted cost according to the following criteria:
Item Price Rate
Up to Rs. 2000 Nil
From Rs. 2001 to Rs. 5000 10% of the cost
From Rs. 5001 to Rs. 7000 15% of the cost
More than Rs. 7000 20% of the cost
void display() : Displays according to the following
Item Price Discount Amount
---- ---- ---- ----
8. Define a class interest having the following description:
Class name : interest
Data members
double p : Stores the Principal Amount
double r : Stores the rate
int t : Stores the time
double si : Stores the simple interest
double amt : Stores the amount
Member Methods
void input() : Inputs the p,r and t
void calculate() : Calculates the Simple Interest. Also, the final amount to be paid. Formula: SI=p * r * t / 100
void show() : Prints the SI and Amount
9. Define a class School_Library with the following data members and methods:
Class name : School_Library
Data Members
String name : Book Name
int day_late : No. of days late
double fine : fine amount to be paid
Methods
void accept () : Accepts the name and the number of days late.
void calculate() : calculates the fine according to the following
days late fine
1st 5 days Rs. 5 per day
Next 10 days Rs. 7 per day
Next 15 days Rs. 10 per day
More than 30 days Rs. 15 per day
void display() : Prints the details according to the following format:
Name of Book Number of days late Total Fine
----- ----- -----
287
Class as the Basis of all Computation 287

