mhatre.ganesh20

Object Oriented Programming Practical 11

Object Oriented Programming Practical 11 Question 1 WAP to implement inheritance shown below figure. Assume suitable member function. furniture.cpp C #include<iostream.h> #include<conio.h> class furniture { int price; char material[100]; public: void accept() { cout<<"nEnter material of furniture: "; cin>>material; cout<<"nEnter furniture price: "; cin>>price; } void display() { cout<<"nFurniture material: "<<material; cout<<"nFurniture number: "<<price; }

Object Oriented Programming Practical 11 Read More »

Object Oriented Programming Practical 10

Object Oriented Programming Practical 10 Question 1 WAP to implement default constructor that initializes num1 and num2 as 10 and 20 and prints the values of num1 and num2. numbers.cpp C #include <iostream.h> #include <conio.h> class MyNumbers { public: int num1; int num2; MyNumbers() { num1 = 10; num2 = 20; } void show() {

Object Oriented Programming Practical 10 Read More »

Object Oriented Programming Practical 9

Object Oriented Programming Practical 9 Question 1 Write a C++ program to declare class ‘Account’ having data members as Account_No and Balance. Accept this data for 10 accounts and display data of Accounts having balance greater than 10000. account.cpp C #include<iostream.h> #include<stdio.h> #include<conio.h> class Account { public: int acno; float balance; void accept() { cout<<"nEnter

Object Oriented Programming Practical 9 Read More »

Object Oriented Programming Practical 8

Object Oriented Programming Practical 8 Question 1 Write a Program to define a class having data members principal, duration and rate of interest. Declare rate _of_ interest as static member variable. Calculate the simple interest and display it. interest.cpp C #include <iostream.h> #include <conio.h> class Interest { private: float principal; int duration; public: static float

Object Oriented Programming Practical 8 Read More »

Object Oriented Programming Practical 7

Object Oriented Programming Practical 7 Question 1 Write a C++ program to exchange the values of two variables using friend function. swap.cpp C #include <iostream.h> #include <conio.h> class Number { private: int value; public: void accept(int x) { value=x; } void display() { cout << value << endl; } friend void swap(Number &num1, Number &num2);

Object Oriented Programming Practical 7 Read More »

Object Oriented Programming Practical 6

Object Oriented Programming Practical 6 Question 1 Write a C++ program to create a class “Number” having data members n1 and n2 and perform mathematical operations like addition, subtraction, multiplication and division on two numbers using inline functions. number.cpp C #include <iostream> #include <conio.h> class Number { private: int n1, n2; public: void accept() {

Object Oriented Programming Practical 6 Read More »

Object Oriented Programming Practical 5

Object Oriented Programming Practical 5 Question 1 Write a C++ program to declare a class “staff’ having data members name, basic salary, DA, HRA and calculate gross salary. Accept and display data for one staff. Where DA=74.5% of basic HRA= 30% of basic. Gross_salary=basic+HRA+DA staff.cpp C #include <iostream.h> #include <conio.h> class staff { private: char

Object Oriented Programming Practical 5 Read More »

Object Oriented Programming Practical 4

Object Oriented Programming Practical 4 Question 1 Write a program to define a class student having data members name and roll no. Accept and display data for one object. Define the member function inside the class. student.cpp C #include <iostream.h> #include <conio.h> class Student { private: char name[30]; int rollNo; public: void acceptData() { cout

Object Oriented Programming Practical 4 Read More »

Object Oriented Programming Practical 3

Object Oriented Programming Practical 3 Question 1 Find the area of the rectangle by casting double data into float and int type. area.cpp C #include<iostream.h> #include<conio.h> void main() { double l,w; float area_float; int area_int; cout << "Enter the length of rectangle: "; cin >> l; cout << "Enter the width of rectangle: "; cin

Object Oriented Programming Practical 3 Read More »

Object Oriented Programming Practical 2

Object Oriented Programming Practical 2 Question 1 Write a C++ Program which show the use of function outside the class using scope resolution operator function.cpp C #include<iostream.h> #include<conio.h> class MyClass { public: void display(); }; void MyClass::display() { cout << "This function is outside class"<<endl; } void main() { clrscr(); MyClass obj; obj.display(); getch(); }

Object Oriented Programming Practical 2 Read More »