Page 288 - CA_Blue( J )_Class10
P. 288

3.  Define a class Bill as described below:
                    Class name     :   Bill
                    Data members
                    name           :    to store the name of the consumer
                    cons_no        :   to store the consumer number
                    unit_con       :   to store the unit consumed
                    Member Methods
                    void getdata()   :   to accept the data members
                    void compute()   :    to calculate the bill amount as per criteria.
                    Units                                Rate
                    Up to 120 units                      Rs. 1.20
                    More than 120 and up to 250 units       Rs. 2.20
                    More than 250 and up to 400 units       Rs. 3.20
                    Above 400 units                      Rs. 4.00
                    void display()    :    To display the output as per the format:
                    Consumer Name       Consumer No   Unit Consumed     Bill Amount
                    –                   –            –                  –
                  4.  Define a class School_book with the following specifications.
                    Class name      :  School_book
                    Instance variables/data members
                    name           :  int type to store the Name of the book
                    author_name     :   String type to store the Author Name of the book
                    price_book      :  stores the price of a book
                    number_book    :   stores the number of books to be bought
                    Member Methods
                    void accept()      :  to read the data members
                    void cal_cost()    :   to calculate the total cost of the number of copies (price  of each book x number of book)
                    void display()     :  Prints the details
                    Write the main method to create an object of the class and call the above member methods.
                  5.  Define a class named BookFair with the following description:
                    Class name    :  BookFair
                    Instance variables/Data members
                    String Bname    :  stores the name of the book.
                    double price    :  stores the price of the book.
                    Member Methods
                    void input()    :  to input and store the name and the price of the book.
                    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 or Rs. 3000   10% of price
                    More than Rs. 3000 15% of price
                    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.
                  6.  Design a class RailwayTicket with the following description:
                    Class name     :  RailwayTicket
                    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 the customer’s mobile number
                    int amt        :   To store the 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 amount
                    void update()    :   To update the amount as per the coach selected
                    (extra amount to be added to the amount as follows)




                286286  Touchpad Computer Applications-X
   283   284   285   286   287   288   289   290   291   292   293