Sunday, 23 April 2017

CLASS-XII ASSIGNMENT CH-4 (CLASSES AND OBJECTS)


MAXFORT SCHOOL ROHINI
CLASS-XII
ASSIGNMENT CH-4 (CLASSES AND OBJECTS)



Q1. Write a complete program by considering a class Book with the following specification                                                                                      
Private members of the class Book are –
                Book_No integer ,Book_Title 20 char, Price float , (price per copy)
                Total_Cost ( ) . A function  to calculate the total cost for N numbers of copies, where N is passed to the function as argument.
                Public members of the class Book are –
                INPUT( ) function to read Book_No,Book_Title, Price.
                PURCHASE() function to ask the user to input no. of copies to be purchased. It invokes Total_Cost( ) & prints the total cost to be paid by the user.

Q2. Write a complete program by considering a class TEST in C++ with following description:                                                                                   
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1)
Public Members
A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres
A function DISPTEST() to allow user to view the content of all the data members

Q3. Write a complete program by considering a class Candidate in C++ with following description:                                                                       
Private Members
·         A data member RNo (Registration Number) of type long
·         A data member Name of type string
·         A data member Score of type float
·         A data member Remarks of type string349
·         A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate.
Score range and the respective Remarks are shown as follows:
·         Score                                             Remarks
·         >=50                                              Selected
·         less than 50                                Not selected
Public Members
·         A function ENTER ( ) to allow user to enter values for RNo, Name, Score & call function AssignRem( ) to assign the remarks.
·         A function DISPLAY ( ) to allow user to view the content of all the data members.
·          
Q4. Write a complete program by considering a class ITEM in C++ with following description:                                                                  
Private members:
·         Icode of type integer (Item Code)
·         Iname of type string (Item Name)
·         Price  of type Float (Price of each item)
·         Qty of type integer (Quantity in stock)
·         Discount of type float (Discount percentage on the item)
·         A find function finddisc( ) to calculate discount as per the following rule:
o   If Qty <=50 discount is 0%
o   If 50 < Qty <=100 discount is 5%
o   If Qty>100 discount is 10%
Public members:
·         A function Buy( ) to allow user to enter values for Icode, Item, Price, Qty and call function finddisc ( ) to calculate the discount.
·         A function showall ( ) to allow user to view the content of all the data members.

Q5. Write a complete program by considering a class named ADMISSION in C++ with the following descriptions:
Private members:                                                                                                                                                           
AD_NO integer (Ranges 10-2000)
a.       NAME Array of characters(String)
b.      CLASS Character
c.       Fees Float
Public members:
a.       Function Read_Data() to read and object of Admission type
b.      Function Display() to display the details of an object
c.       Function Draw_Nos() to choose 2 students randomly and display the details. Use random function to generate admission nos. to match with AD_NO.
Q6. Write a complete program by considering a class employee with the following specifications:
            Private members
            empno                         integer type
            ename                         20 character
            basic,hra,da                float
            netpay                        float
         ctotal( )                         A function to calculate the total as basic+hra+da with float return type.
            Public members:
         takedata ( )                function to read empno, ename,basic,hra,da and invoke ctotal( ) to calculate total.
         showdata ( )              to display all the data members on the screen.

Q7.     Write a complete program by considering a class worker with the following specification:
            Private members
                        Wno                           integer
                        wname                     20 character
                hrwrk,wgrate      float (hours worked and wagerate per hour)
                totwage               float (hrwrk * wgrate)
               calwg( )              A function to calculate the totwage  with float return type.
            Public members:
                     takedata ( )    function to reed wno, wname ,hrwrk, wgrate and invoke calwgl( ) to calculate total wages.
                     showdata ( ) function to display all the data members on the screen.