Object Oriented New
Object Oriented New
Object Oriented New
void display()- To display customer, mobile number, amount to be paid after discount.
Write a main() method to create an object of the class and call the above methods.
QUESTION 2
QUESTION 3
QUESTION 4
Member Methods:
(i) BookFair() – Default constructor to initialize data members.
(ii) void Input() – To input and store the name and the price of the book.
(iii) void calculate() – To calculate the price after discount. Discount is calculated based on the following
criteria.
PRICE DISCOUNT
Less than or equal to Rs 1000 2% of price
More than Rs 1000 and less than or equal to Rs 3000 10% of price
More than Rs 3000 15% of price
(iv) void display() – To display the name and price of the book after discount.
Write a main method to create an object of the class and call the above member methods.
QUESTION 5
QUESTION 6:
Member Methods:
(i) movieMagic() Default constructor to initialize numeric data members to 0 and String data member to “”.
(ii) void accept() To input and store year, title and rating.
(iii) void display() To display the title of a movie and a message based on the rating as per the table below.
RATING MESSAGE TO BE DISPLAYED 0.0 to 2.0 Flop 2.1 to 3.4 Semi-hit 3.5 to 4.5 Hit 4.6 to 5.0 Super
Hit Write a main method to create an object of the class and call the above member methods.
QUESTION 7
QUESTION 8
Member Methods: (i) void input() – To input and store the accession number, title and author.
(ii)void compute – To accept the number of days late, calculate and display and fine charged at the rate of
Rs.2 per day.
(iii) void display() To display the details in the following format: Accession Number Title Author.
Write a main method to create an object of the class and call the above member methods.
QUESTION 9
QUESTION 10
QUESTION 11
QUESTION 12
The basic salary of employees is undergoing a revision. Define a class called Grade_Revision with the following
specifications:
QUESTION 13:
Define a class Bill that calculates the telephone bill of a consumer with the following description:
Data Members Purpose
int bno bill number
String name name of consumer
int call no. of calls consumed in a
month
double amt bill amount to be paid by the person
Member Methods Purpose
Bill() constructor to initialize data members with default initial value
Bill(...) parameterised constructor to accept billno, name and no. of calls consumed
Calculate() to calculate the monthly telephone bill for a consumer as per the table given below Display() to
display the details
Units consumed Rate
First 100 calls ₹0.60 / call
Next 100 calls ₹0.80 / call
Next 100 calls ₹1.20 / call
Above 300 calls ₹1.50 / call
Fixed monthly rental applicable to all consumers: ₹125
Create an object in the main() method and invoke the above functions to perform the desired task.
QUESTION 14:
Define a class customer as below
Data members:
cardName–Name of the card holder
cardNo – a long card number
cardType – Type of the card character 'P' for Platinum, 'G' for Gold, 'S' for Silver.
Member methods:
QUESTION 15:
Write a program to define a class HotelBill as below
Data Members:
Member Methods:
QUESTION 16:
Define a class to describe your friends as follows:
Data Members: serial number, name, address, phone number, date_of_birth, birthday month, birth year.
Member Methods: