0% found this document useful (0 votes)
3 views5 pages

Adobe Scan May 02, 2025

Uploaded by

akki01kumari2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Adobe Scan May 02, 2025

Uploaded by

akki01kumari2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Define a class named movieMagic with the following description:

Instance variables/data members:

int year to store the year of release of a movie


String title to store the title of the movie.

float rating to store the popularity rating of the movie.


(minimum rating =0.0 and maximum rating = 5.0)

Member Methods:

(i) movieMagic) Default constructor to initialize numeric data members to 0 and

String data member to ".


(i void accept) To input and store year, title and rating.
(iii) void display0 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. [15]
Define a class ElectricBill with the following specifications: [15)
class ElectricBill
Instance variables / data member:
String n-to store the name of the customer
int units - to store the number of units consumed
double bill -to store the amount to be paid
Membet methods:
void accept() - to accept the name ofthecustomer and number of units consumed
void calculate( ) to calculate the bill as per the following tarif:
Number of units Rate per unit
First 100 units Rs.2.00
Next 200 units Rs.3.00
Above 300 units Rs.5.00
A surcharge of 2.5% charged if the number of units consumed is above 300 units.
void print ()- To print the details as follows:
Name of the customer:
Number of units consumed:
Bill amount:
Write a main method to create an object of the class and call the above member
methods.
Define a class named BookFair with the following description : [15]
Instance variables /Data members :
String Bname - stores the name of the book
double price- stores the price of the book

Member methods :
() BookFair() Default constructor to initialize data members
(ii) void nput() To input and store the name and the price of the book.
(ii) void calculate() To calculate the price after discount. Discount is calculated
based on the following criteria
Price Discount

Less than or equal to I000 2% of price


More than t 1000 and less than or equal to 3000 10% of price
More than 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.
Define a class called ParkingLot with the following description:
Instance variables ldata members :
int vno -To store the vehicle number
int hours- To store the number of hours the vehicle is parked in the parking lot
double bill : To store the bill amount
Member methods:
void input) -To input and. storethe vno and hours.

void calculate) - To compute the parking charge at the rate of 3for the first hour or part
thereof, and1.50 for each additional hour or part thereof.
void display) - To display the detail
Write a main method to create an object of the class and call the above methods. [13]
Questio.
Design a class RailwayTicket with following description: [15]
Instance variables/data members

String name To store the name of the customer

String coach To store the type of coach customer wants


to
travel

long mobno To store customer's mobile


number
int amt
To store basic amount of ticket
int totalamt
To store the amount to be paid
after updating
the original amount
Member methods

void accept ) To take input for name,


coach, mobile number and
void update) To update the amount
amount.
as per the coach
selected
(extra amount to be added
in the amount as
follows)
Type of Coaches
Amount
First_AC 700
Second_AC 500
Third_AC 250
void display) sleeper None
To display all
details of a customer
amount and mobile such as name,
number. coach, total
Write a main
method to create an
methods. object of the class
and call the
above member

You might also like