Assignments Jul13 Class12

Embed Size (px)

Citation preview

  • 8/13/2019 Assignments Jul13 Class12

    1/21

    Assignment ClassXII Computer Science

    Q1. Define a class Departmental with the following specification :

    private data members Prod_name string (45 charactes) [ Product name !istprice long

    Dis_Price long [ Discount Price "et long ["et Price Dis_t#pe char($ or ") [ Discount t#pe %al_price() & 'he store gies a 1* discount on eer# product it sells. +oweerat the time of festial season the store gies ,* festial discount after 1* regulardiscount. 'he discount t#pe can -e checed -# tracing the discount t#pe. /here 0$means festial and 0" means "on2 festial .'he %al_price() will calculate the DiscountPrice and "et Price on the -asis of the following ta-le.

    public members

    %onstructor to initiali3e the string elements with "!!67 numeric elements with and character elements with 0"

    8ccept() 2 8s the store manager to enter Product name7 list Price and discountt#pe . 'he function will inoe %al_price() to calculate Discount Price and "etPrice .

    9howill() 2 'o generate the -ill to the customer with all the details of his;herpurchase along with the -ill amount including discount price and net price.

    Q

  • 8/13/2019 Assignments Jul13 Class12

    2/21

    Public members :

    8 function to input data mem-ers.

    8 function C"'8=( ) to enter data for the taB pa#er and call function %omp'aB( )to assign 'ot'aB.

    8 function K'8=( ) to allow user to iew the content of all the data mem-ers.QH. Define a class @?9K@' with the following specifications.

    Private members:Data members

    : roomno2 int7 name2 string7 charges2 float7 da#s2 int7 amount2float.Member function: compute( ) 2 'o calculate and return amount as da#s M charges and if the alue of da#s M charges is more than ( ) a mem-er function to calculate penalt# runs as follows :Cf ?Btra_timeFG1 then 5 runs should -e added to 'arget_runsCf ?Btra_timeE1 and FG

  • 8/13/2019 Assignments Jul13 Class12

    3/21

    8 function Cnput ( ) to input the alues of the data mem-ers L%ode7L'#pe7 L9i3e andL$a-ric and inoe the 8ssign ( ) function.

    8 function Displa# ( ) which displa#s the content of all the data mem-ers for a Larment.

    CONSTRUCTORS AN !STRUCTORS

    Q1.(a) 8nswer the Ouestions(i) and (ii) after going through the following program:

    class Iatch

    int 'ime

    pu-lic:

    Iatch( ) ;;$unction 1

    'ime G

    cout FF Iatch commences6 FFendl

    R

    oid Details( ) ;;$unction