Friday, January 23, 2009

OOP ASSIGNMENT - 4

1. Write a class “employee” to store following information Name, employee ID, Age, Marital Status, and Salary. WAP to store information for 3 employees and display the results.

2. Implement a class “number” having data members value This class has a member function FindDigit() to count the occurrences of each digit in number object. Ex-If value = 1123, O/P = 1-Two times, 2 – One times and 3- One times

3.Define a class named Complex for representing complex numbers. A complex
number has the general form a + ib, where a is the real part and b is the imaginary
part (i stands for imaginary). Complex arithmetic rules are as follows:
(a + ib) + (c + id) = (a + c) + i(b + d)
(a + ib) – (c + id) = (a + c) – i(b + d)
(a + ib) * (c + id) = (ac – bd) + i(bc + ad)
Define these operations as member functions of Complex.

4. Create a string by using class , encrypt it & display it according to given instructions. A-Z, a-z, 0-9,’=’, ’,’, ’.’------- No changes. The space is replaced by ‘+’. Any other character is replaced by ‘%’ followed by ASCII value of that character.

No comments: