Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

OOPs Programs



OOPs

1. Imagine a tollbooth with a class called toll Booth. The two data items of a type unsigned int to hold the total number of cars, and a type double to hold the total  amount of money collected. A constructor initializes both these to 0. A member function called payingCar() increments the car total and adds 0.50 to the cash total. Another function, called nopayCar() increments the car total but adds nothing to the cash total. Finally, a member function called displays the two totals.
2. Program to swap two numbers using class template.
3. Write a program that uses a structure to store these 3 parts of a phone no. separately call structure phone create two structure variable of type phone. Initialize one and have the input from user for another no. and display both the nos.
4. Write a function called power that takes double value for n and int value for p and return the result as double. use default argument of 2 for p if this argument is omitted.
5. A hospital wants to create a database regarding its indoor patients. The information to store include :- Name of the patient, Date of admission, Disease, Date of discharge.





6. Write a program to find mean value of 2 numbers using friend function
7. Create two classes DM and DB which store the value of distances. DM stores in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB.Use a friend function to carry out the addition operation. The object that stores the results maybe DM object or DB object depending on the units in which the results are required. The display should be in the format of feet and inches or meters and centimeters depending on object on display.
8. Addition of two coordinates
9. Calculator implementation using switch