Wednesday, January 21, 2009

OOPS ASSIGNMENT - 3

1. Write a program which inputs a positive integer n and outputs 2 raised to the power of n.

2. WAp to calculates the weekly gross pay for a worker, based on the total number of hours worked and the hourly payrate.

Hint. weeklyPay = workDays * workHours * payRate

3. Write a program which inputs a temperature reading expressed in Fahrenheit and outputs its equivalent in Celsius, using the formula:
°C = 5/9 (° F - 32)

Compile and run the program. Its behavior should resemble this:
Temperature in Fahrenheit: 41
41 degrees Fahrenheit = 5 degrees Celsius

4. Create a class to find the sum of two numbers. This includes two data members, three member functions to input , output the data members and to find the sum of two data members.

5. Create a class to find the multiplication of two matrices. This include three data members of type arrays, three member functions, one is to accept two matrices, other to display two matrices and 3rd one is to find the multiplication of two matrices and display the result.

6. Create a class time with data members to store hours, minutes and seconds. WAP to input two times and find their sum.

7. Implement a class “number” having data members value and include following member functions
(i) IsEven()->Checks whether the value is even or odd
(ii) Findfactorial()->to calculate the factorial of the number

No comments: