SlideShare a Scribd company logo
1 of 3
Exp.1 Write any C++ program to demonstrate Encapsulation feature of an Object Oriented
Programming.

(Aim:- The main aim of this experiment is providing security to data from outside code and identifying
objects from given problem statement.)

Objective: Student will get practical awareness about encapsulation concept.

Example programs:

   a. Define a Calculator class. Create Calculators and invoke them for input from cin, from
      command-line arguments, and for strings in the program. Allow output to be delivered to a
      variety of targets similar to the way input can be obtained from a variety of sources.
   b. Define a Student class which contains a student’s confidential information. Note:- Analyze and
      consider more attributes and two member functions for reading and updating.
   c. Define a Fruit class which contains all information of a fruit and member function. Note:-
      Analyze and consider more attributes and two member functions for reading and updating.

Exp.2 Write any C++ program to demonstrate “Encapsulation of member functions and data members
with its default values and its initialization when an object was created” concept.

(Aim:- The main aim of this experiment is providing security to data from outside code and identifying
objects from given problem statement and its initialization. )

Objective: Student will get practical awareness about encapsulation, constructors and default
constructors concepts.

Example Programs:

       a. Define a Baby class and identify attributes of a baby and initialize them when a baby was
          born.
       b. Define a Book class and identify attributes of a book and initialize them when a book was
          manufactured.
       c. Define a Vehicle class and identify its attributes and initialize them when a vehicle was
          manufactured.
       d. Define a class String that could work as a user-defined string type. Include constructors that
          will enable us to create an uninitialized string
                        String s1; // string with length 0.
               and also to initialize an object with a string constant at the time of creation like
                        String s2(“hello”);
               Include a function that adds two strings to make a third string. Note that the statement
                        s2 = s1;
               will be perfectly reasonable expression to copy one string to another.
               Write a complete program to test your class to see that it does the following tasks:
                        i.       Creates uninitialized string objects.
ii.     Creates objects with string constants.
                          iii.    Concatenates two strings properly.
                          iv.     Displays a desired string object.



Exp.3 Write any C++ programs to demonstrate multilevel inheritance concept of an object oriented
programming.

(Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects ,
identifying specific and generic objects and creating hierarchy between objects ).

Objective: Student will get awareness to create relationship between objects.

Example Programs:-

    a. Assume that a bank maintains two kinds of accounts for customers, one called as savings
        account and the other as current account. The savings account provides compound interest and
        withdrawal facilities but no cheque book facility. The current account provides cheque book
        facility but no interest. Current account holders should maintain a minimum balance and if the
        balance falls below this level, a service charge is imposed.
       Create a class account that stores customer name, account number and type of account. From
       this derive the classes cur_acct and sav_acct to make them more specific to their requirements.
       Include necessary member functions in order to achieve the following tasks:

    i.          Accept deposit from a customer and update the balance.
    ii.        Display the balance
    iii.       Compute and deposit interest.
    iv.        Permit withdrawal and update the balance.
    v.         Check for the minimum balance, impose penalty, necessary, and update the balance.
           Don’t use constructors to initialize the class members.

    b. implement above program using constructors to initialize the class members.

    c. An educational institution wishes to maintain a database of its employees.




Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented
programming.

(Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects ,
identifying specific and generic objects and creating hierarchy between objects ).
Objective: Student will get awareness to create relationship between objects.

Example Programs:-




Exp.5 Write any C++ programs to demonstrate hierarchal inheritance concept of an object oriented
programming.

(Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects ,
identifying specific and generic objects and creating hierarchy between objects ).

Objective: Student will get awareness to create relationship between objects.



Example Programs:-




Exp.6   Write any C++ programs to demonstrate access controls of an object oriented programming.

( Aim:- The main aim of this experiment is, “identifying which members are private members, which
members are public members, which members are constant members which members are static
members ext…”)

Objective: Student will get awareness in the usage of access specifies, friend functions, virtual functions
in implementation.

Example Programs:-

More Related Content

What's hot

Rakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearRakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearDezyneecole
 
polymorphism
polymorphismpolymorphism
polymorphismSujan Mia
 
Pinkle Makhijani ,BCA 2nd Year
Pinkle  Makhijani ,BCA 2nd YearPinkle  Makhijani ,BCA 2nd Year
Pinkle Makhijani ,BCA 2nd Yeardezyneecole
 
Bca2030 object oriented programming – c++
Bca2030   object oriented programming – c++Bca2030   object oriented programming – c++
Bca2030 object oriented programming – c++smumbahelp
 
Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year dezyneecole
 
Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year dezyneecole
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsNilesh Dalvi
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Yeardezyneecole
 
Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Yeardezyneecole
 
Deepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd YearDeepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd Yeardezyneecole
 
Ram Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd YearRam Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd Yeardezyneecole
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Yeardezyneecole
 
Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Yeardezyneecole
 
Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.dezyneecole
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentEduardo Bergavera
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Yeardezyneecole
 
Assignments 150507052746-lva1-app6891
Assignments 150507052746-lva1-app6891Assignments 150507052746-lva1-app6891
Assignments 150507052746-lva1-app6891Mohit Saini
 
Kaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd YearKaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd Yeardezyneecole
 
Ravi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd YearRavi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd Yeardezyneecole
 

What's hot (20)

Rakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearRakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third Year
 
polymorphism
polymorphismpolymorphism
polymorphism
 
Pinkle Makhijani ,BCA 2nd Year
Pinkle  Makhijani ,BCA 2nd YearPinkle  Makhijani ,BCA 2nd Year
Pinkle Makhijani ,BCA 2nd Year
 
Bca2030 object oriented programming – c++
Bca2030   object oriented programming – c++Bca2030   object oriented programming – c++
Bca2030 object oriented programming – c++
 
Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year
 
Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Year
 
Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year
 
Deepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd YearDeepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd Year
 
Ram Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd YearRam Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Year
 
Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Year
 
Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.
 
Lesson1
Lesson1Lesson1
Lesson1
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software Development
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
 
Assignments 150507052746-lva1-app6891
Assignments 150507052746-lva1-app6891Assignments 150507052746-lva1-app6891
Assignments 150507052746-lva1-app6891
 
Kaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd YearKaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd Year
 
Ravi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd YearRavi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd Year
 

Similar to M.tech oops through_c++_labmanual1 (1)

Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageGeorges Abboudeh
 
Ee java lab assignment 2
Ee java lab assignment 2Ee java lab assignment 2
Ee java lab assignment 2Kuntal Bhowmick
 
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...bhargavi804095
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 OctSriram Raj
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classccis224477
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classcis247
 
Learn Concept of Class and Object in C# Part 3
Learn Concept of Class and Object in C#  Part 3Learn Concept of Class and Object in C#  Part 3
Learn Concept of Class and Object in C# Part 3C# Learning Classes
 
Assignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docxAssignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docxssuser562afc1
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classsdjdskjd9097
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 

Similar to M.tech oops through_c++_labmanual1 (1) (20)

Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming language
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Ee java lab assignment 2
Ee java lab assignment 2Ee java lab assignment 2
Ee java lab assignment 2
 
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...
 
11-Classes.ppt
11-Classes.ppt11-Classes.ppt
11-Classes.ppt
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
EEE 3rd year oops cat 3 ans
EEE 3rd year  oops cat 3  ansEEE 3rd year  oops cat 3  ans
EEE 3rd year oops cat 3 ans
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 Oct
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee class
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee class
 
Learn Concept of Class and Object in C# Part 3
Learn Concept of Class and Object in C#  Part 3Learn Concept of Class and Object in C#  Part 3
Learn Concept of Class and Object in C# Part 3
 
Assignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docxAssignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docx
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee class
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Oop
OopOop
Oop
 
Ex
ExEx
Ex
 

M.tech oops through_c++_labmanual1 (1)

  • 1. Exp.1 Write any C++ program to demonstrate Encapsulation feature of an Object Oriented Programming. (Aim:- The main aim of this experiment is providing security to data from outside code and identifying objects from given problem statement.) Objective: Student will get practical awareness about encapsulation concept. Example programs: a. Define a Calculator class. Create Calculators and invoke them for input from cin, from command-line arguments, and for strings in the program. Allow output to be delivered to a variety of targets similar to the way input can be obtained from a variety of sources. b. Define a Student class which contains a student’s confidential information. Note:- Analyze and consider more attributes and two member functions for reading and updating. c. Define a Fruit class which contains all information of a fruit and member function. Note:- Analyze and consider more attributes and two member functions for reading and updating. Exp.2 Write any C++ program to demonstrate “Encapsulation of member functions and data members with its default values and its initialization when an object was created” concept. (Aim:- The main aim of this experiment is providing security to data from outside code and identifying objects from given problem statement and its initialization. ) Objective: Student will get practical awareness about encapsulation, constructors and default constructors concepts. Example Programs: a. Define a Baby class and identify attributes of a baby and initialize them when a baby was born. b. Define a Book class and identify attributes of a book and initialize them when a book was manufactured. c. Define a Vehicle class and identify its attributes and initialize them when a vehicle was manufactured. d. Define a class String that could work as a user-defined string type. Include constructors that will enable us to create an uninitialized string String s1; // string with length 0. and also to initialize an object with a string constant at the time of creation like String s2(“hello”); Include a function that adds two strings to make a third string. Note that the statement s2 = s1; will be perfectly reasonable expression to copy one string to another. Write a complete program to test your class to see that it does the following tasks: i. Creates uninitialized string objects.
  • 2. ii. Creates objects with string constants. iii. Concatenates two strings properly. iv. Displays a desired string object. Exp.3 Write any C++ programs to demonstrate multilevel inheritance concept of an object oriented programming. (Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects , identifying specific and generic objects and creating hierarchy between objects ). Objective: Student will get awareness to create relationship between objects. Example Programs:- a. Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current account. The savings account provides compound interest and withdrawal facilities but no cheque book facility. The current account provides cheque book facility but no interest. Current account holders should maintain a minimum balance and if the balance falls below this level, a service charge is imposed. Create a class account that stores customer name, account number and type of account. From this derive the classes cur_acct and sav_acct to make them more specific to their requirements. Include necessary member functions in order to achieve the following tasks: i. Accept deposit from a customer and update the balance. ii. Display the balance iii. Compute and deposit interest. iv. Permit withdrawal and update the balance. v. Check for the minimum balance, impose penalty, necessary, and update the balance. Don’t use constructors to initialize the class members. b. implement above program using constructors to initialize the class members. c. An educational institution wishes to maintain a database of its employees. Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented programming. (Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects , identifying specific and generic objects and creating hierarchy between objects ).
  • 3. Objective: Student will get awareness to create relationship between objects. Example Programs:- Exp.5 Write any C++ programs to demonstrate hierarchal inheritance concept of an object oriented programming. (Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects , identifying specific and generic objects and creating hierarchy between objects ). Objective: Student will get awareness to create relationship between objects. Example Programs:- Exp.6 Write any C++ programs to demonstrate access controls of an object oriented programming. ( Aim:- The main aim of this experiment is, “identifying which members are private members, which members are public members, which members are constant members which members are static members ext…”) Objective: Student will get awareness in the usage of access specifies, friend functions, virtual functions in implementation. Example Programs:-