Tuesday, July 12, 2011

PDS LAB EX:1

            PDS-II             LAB 1            -  13.7.2011  



A)  Define a class to represent a bank account. Include the following members:

             Data members:

1.      Name of the depositor
2.      Account number
3.      Type of account
4.      Balance amount in the account

 Member functions
1.      To assign initial values
2.      To deposit an amount
3.      To withdraw an amount after checking the balance
4.      To display name and balance of a particular customer.
5.      To display the entire customer details.
        Write a menu driven program to perform all the above functions for atleast  5  customers.

----------------------------------------------------------------------------------------------------------------

B)    Write a program to perform arithmetic operations (+, -, *, /, or addition, subtraction, multiplication, and division----functions) on complex numbers: –using reference variables.

( hint
+: (a1 + b1j) + (a2 + b2j) = (a1 + a2) + (b1 + b2)j
-: (a1 + b1j) – (a2 + b2j) = (a1 – a2) + (b1 – b2j)
*: (a1 + b1j) * (a2 + b2j) = (a1a2 – b1b2) + (a1b2 + a2b1) j
/: (a1+b1j) / (a2 + b2j) = (a1 + b1j) * (a2 – b2j) / (a22 + b22)= [(a1a2 + b1b2) + (a2b1 – a1b2)j] / (a22 + b22)
      )
---------------------------------------------------------------------------------------------------------------
C)    Above program – pass the entire object as function argument. Increment the data members after each operation.
----------------------------------------------------------------------------------------------------------------
D)    Write a function Area to calculate the area of various shape objects (ex. Square, circle , triangle etc using Function overloading 
----------------------------------------------------------------------------------------------------------------
E)     Write a simple program to show the use of static variables and static functions.
----------------------------------------------------------------------------------------------------------------
F)     Implement the stack using push and pop operations
----------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment