1.
Define a class called Library with the following description:
Instance Variables/Data Members:
int accNum — stores the accession number of the book.
String title — stores the title of the book.
String author — stores the name of the author.
Member methods:
    1. Library()-non parameterized constructor to initialize the data members..
    2. void input() — To input and store the accession number, title and author.
    3. void compute() — To accept the number of days late, calculate and display the
       fine charged at the rate of Rs. 2 per day.
    4. void display() — To display all the details:
Write a main method to create an object of the class and call the above member
methods.
2. Define a class named FruitJuice with the following description:
          Data Members                                            Purpose
  int product_code                      stores the product code number
  String flavour                        stores the flavour of the juice
  String pack_type                      stores the type of packaging
  int pack_size                         stores package size
  int product_price                     stores the price of the product
      Member
                                                            Purpose
      Methods
  FruitJuice()          constructor to initialize integer data
                        to input and store the product code, flavour, pack type, pack size and
  void input()
                        product price
  void discount()       to reduce the product price by 10
                        to display the product code, flavour, pack type, pack size and product
  void display()
                        price
Write a main method to create an object of the class and call the above member methods.
                                                        1
3.Define a class named movieMagic with the following description:
    Data Members                                       Purpose
  int year                To store the year of release of a movie
  String title            To store the title of the movie
                          To store the popularity rating of the movie
  float rating
                          (minimum rating=0.0 and maximum rating=5.0)
      Member
                                                   Purpose
      Methods
                      Default constructor to initialize numeric data members to 0 and
  movieMagic()
                      String data member to "".
  void accept()       To input and store year, title and rating
                      To display the title of the movie and a message based on the
  void display()
                      rating as per the table given below
Ratings Table
             Rating                         Message to be displayed
  0.0 to 2.0                Flop
  2.1 to 3.4                Semi-Hit
  3.5 to 4.4                Hit
  4.5 to 5.0                Super-Hit
Write a main method to create an object of the class and call the above member methods.
                                                   2
4. Define a class called ParkingLot with the following description:
Instance variables/data 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:
ParkingLot ()-non parameterized constructor to initialize the data members..
void input() — To input and store the vno and hours.
void calculate() — To compute the parking charge at the rate of ₹3 for the first hour or
part thereof, and ₹1.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.
5. Define a class named BookFair with the following description:
Instance variables/Data members:
String Bname — stores the name of the book
double price — stores the price of the book
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 ₹1000                                  2% of price
 More than ₹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.
                                             3
6. Define a class ElectricBill with the following specifications:
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
Member methods:
ElectricBill()-Default constructor to initialize data members
void accept( ) — to accept the name of the customer and number of units consumed
void calculate( ) — to calculate the bill as per the following tariff:
                       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.
7. Design a class RailwayTicket with following description:
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:
RailwayTicket()-Default constructor to initialize data members
void accept() — To take input for name, coach, mobile number and amount.
void update() — To update the amount as per the coach selected (extra amount to be
added in the amount as follows)
                                                    4
        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.
8. Design a class name ShowRoom with the following description:
Instance variables / Data members:
String name — To store the name of the customer
long mobno — To store the mobile number of the customer
double cost — To store the cost of the items purchased
double dis — To store the discount amount
double amount — To store the amount to be paid after discount
Member methods:
ShowRoom() — default constructor to initialize data members
void input() — To input customer name, mobile number, cost
void calculate() — To calculate discount on the cost of purchased items, based on following criteria
                                  Cost                                           Discount (in percentage)
  Less than or equal to ₹10000                                             5%
  More than ₹10000 and less than or equal to ₹20000                        10%
  More than ₹20000 and less than or equal to ₹35000                        15%
  More than ₹35000                                                         20%
void display() — To display customer name, mobile number, amount to be paid after discount.
Write a main method to create an object of the class and call the above member methods.
                                                  5
9. Design a class with the following specifications:
Class name: Student
Member variables:
name — name of student
age — age of student
mks — marks obtained
stream — stream allocated
(Declare the variables using appropriate data types)
Member methods:
1.Student()_default constructor to initialize data members
2.void accept() — Accept name, age and marks using methods of Scanner class.
3.void allocation() — Allocate the stream as per following criteria:
              mks                                      stream
  >= 300                           Science and Computer
  >= 200 and < 300                 Commerce and Computer
  >= 75 and < 200                  Arts and Animation
  < 75                             Try Again
4.void print() – Display student name, age, mks and stream allocated.
Write a main method to create an object of the class and call the above member methods.
10. Define a class called with the following specifications:
Class name: Eshop
Member variables:
String name: name of the item purchased
double price: Price of the item purchased
Member methods:
1.Eshop()-default constructor to initialize data members
2.void accept(): Accept the name and the price of the item using the methods of Scanner class.
3.void calculate(): To calculate the net amount to be paid by a customer, based on the following
criteria:
                                                       6
         Price                 Discount
  1000 – 25000              5.0%
  25001 – 57000             7.5 %
  57001 – 100000            10.0%
  More than 100000          15.0 %
void display(): To display the name of the item and the net amount to be paid.
Write the main method to create an object and call the above methods.
11. Create a class named Pizza that stores details about a pizza. It should contain the following:
Instance Variables:
String pizzaSize — to store the size of the pizza (small, medium, or large)
int cheese — the number of cheese toppings
int pepperoni — the number of pepperoni toppings
int mushroom — the number of mushroom toppings
Member Methods:
Pizza() — default constructors to initialise all the instance variables
CalculateCost() — A public method that returns a double value, that is, the cost of the pizza.
Pizza cost is calculated as follows:
       Small: Rs.500 + Rs.25 per topping
       Medium: Rs.650 + Rs.25 per topping
       Large: Rs.800 + Rs.25 per topping
void print() — display pizza size, quantity of each topping, and the pizza cost as calculated by
CalculateCost().
Write the main method to create an object and call the above methods.
                                                        7
12. Define a class Laptop described as follows:
Data members/instance variables:
       Name, price, dis, amt
Member Methods:
   1. shop ()-default constructor to initialize the data members
   2. void accept()-To accept the details (name of the customer and the price)
   3. void calculate()-To compute the discount.
       An electronics shop has announced a special discount on the purchase of Laptops as given
       below:
       Category                                                          Discount on Laptop
       Up to ₹25,000                                                     5.0%
       ₹25,001 - ₹50,000                                                 7.5%
       ₹50,001 - ₹1,00,000                                               10.0%
       More than ₹1,00,000                                               15.0%
   4. void display()-To display the name, discount and amount to be paid after discount.
Write a main method to create an object of the class and call the member methods.
   13. Define a class called Library with the following description:
Instance Variables/Data Members:
int accNum — stores the accession number of the book.
String title — stores the title of the book.
String author — stores the name of the author.
Member methods:
   5. Library()-non parameterized constructor to initialize the data members..
   6. void input() — To input and store the accession number, title and author.
   7. void compute() — To accept the number of days late, calculate and display the fine charged at
      the rate of Rs. 2 per day.
   8. void display() — To display all the details:
Write a main method to create an object of the class and call the above member methods.