Basics of Object Oriented Programming(OOP) Programs

 

                                      Programs

Chapter # 13:

                     Basics Of Object-Oriented programming

 

Program 13.1

                   Write a program that declares a class with one integer data member two members function in () and out () to input and output data in data member.



 



Program 13.2

Write a class Marks with three data members to store three marks. Write member function in () to input marks, sum () to calculate and return the sum and avg () to calculate and return the average marks.









Program 13.3

Write a class circle with one data member radius. Write three member function get radius () to set radius value with parameter value, area () to display radius and circum () to calculate and display.




             
 



Program 13.4

Write a class Book with three data member Books ID, Pages and Price. It also contains the member function get (), shoe (), set (), get Price ().






 

Program 13.5

Write a class result that contains roll no, number and marks of three subjects. The marks are stored in an array of integers. The class also contains the member function.






 

Program 13.6

 Write a class array that contains an array of integers to store five values. It also contains member function.





 


Program 13.7

Write a class that displays a simple message on the screen whenever an object of that class is created.





Program 13.8

                  Write a class that contains two integer data member which are initialized to 100 when an object is created.






Program 13.9

    Write a class that has marks and grade as data members. A constructor with tow parameter initializes data members with the given values and member function show displays the values of data members.







 

Program 13.10

Write a class TV that contains attributes of brand name, model and retail price. Write a method to display all attributes and a method to change the attributes.




 

Program 13.11

Write a class that has num and ch as data members. A constructor with no parameter initializes num to 0 ch to x.






 

Program 13.12

Write a class book that has attributes for pages, price and title. It has two functions to input the values and display the values. Create three objects of the class and input values.




 


Program 13.13

Write a class travel that has the attributes of kilometers and hours .A Constructor with no parameter initializes both data members to 0.






 

Program 13.14

Write a class travel that has the attributes of kilometer and hours.  A constructor with no parameter initializes both data members to 0.






 

Program 13.15

Write a program that counts the number of object created of a particular class.





 

 

Program 13.16

Write a program that creates three object of class student .Each object of class must be assigned a unique roll number.

 


 

 


 


 

 

 

Program 13.17

Write a Program that counts the number of objects created of a particular class .The program must be able to display the result even if no object is created so far.






 




Comments

Popular posts from this blog

Fundamentals of Computer Programming C++ Programs