0% found this document useful (0 votes)
148 views

C++ Blank Ass

The document provides instructions for 21 programming exercises involving object-oriented concepts like classes, inheritance, polymorphism, templates, and containers. These include: 1) Defining Student and Employee classes with various data members and methods, 2) Implementing inheritance hierarchies for printers and salary classes, 3) Using virtual functions and pure virtual functions, 4) Generating templates for sorting and stacks, 5) Implementing file I/O to reverse lines, 6) Using maps and sets for student data analysis, 7) Demonstrating run-time polymorphism, 8) Creating a singleton class, and 9) Overloading operators for matrix addition, subtraction and multiplication.

Uploaded by

Vinit Vini Jain
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views

C++ Blank Ass

The document provides instructions for 21 programming exercises involving object-oriented concepts like classes, inheritance, polymorphism, templates, and containers. These include: 1) Defining Student and Employee classes with various data members and methods, 2) Implementing inheritance hierarchies for printers and salary classes, 3) Using virtual functions and pure virtual functions, 4) Generating templates for sorting and stacks, 5) Implementing file I/O to reverse lines, 6) Using maps and sets for student data analysis, 7) Demonstrating run-time polymorphism, 8) Creating a singleton class, and 9) Overloading operators for matrix addition, subtraction and multiplication.

Uploaded by

Vinit Vini Jain
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

1) Write a Student class and use it in your program.

Store the data of ten students and display the sorted data according to their roll numbers, date of births, and total marks.

2) Create a class which will contain roll number, name of the student, & an array for marks of five subjects. Create the marks array dynamically. Accept the input from user, and display the information. Make proper use of constructor to allocate memory. Make use of Destructor to free allocated memory. Modify the above class to have a static member variable count, which will hold the number of objects crated of student class. Add one static method DisplayCount() which will display the count.
3) Design a hierarchy of computer printers. Use multiple inheritance in your hierarchy. Also use friend functions and classes in your program. 4) Write Date and Time classes that allows you to add, subtract, read and print simple dates in dd/mm/yyyy and time in hh:mm:ss forms. Use function overloading in your program. 5) Write a class CString having the following,

Data Abstraction: - Length of the string(int) - Base address of the string (char *) Procedural Abstraction: - Default constructor - Parameterized constructor having char* parameter - Parameterized constructor having int and char parameters - Copy constructor - AcceptString() - DisplayString() - Destructor - Overload the operator = =, [], <<, >>, = so that the following opearations could be done on string class objects s1, s2, s3 cout<<s1<<s2; cin>>s1>>s2; if( s1 = = s2 ), cout<<s1[2] , s1[2] = 'A' s1 = s2; - Also try to create an array of string objects and initialize it at the time of creation. 6). Write a class Employee having following data members - int empid

- string name - Date dob ( implement class date with data members to hold date) Write appropriate constructors and destructor. Use member initialization list to initialize the contained objects. Provide member functions to display the employee information. The employee id should be generated automatically. 7) Derive class WageEmployee publicly from class Employee having Data Abstraction: - No. Of. Hours worked( int ) - Rate per hour( float ) Procedural abstraction: Default value constructor Parameterized constructor AcceptInfo() DisplayInfo() ComputeSalary() Destruvctor

8) Derive a class salesperson publicly from WageEmployee having Data Abstraction: - commission (int) - Sales Made (long) Procedural Abstraction: - Default value constructor - Parameterized Constructor - AcceptInfo() - DisplayInfo() - ComputeSalary() - Destructor 9) Can a pure virtual function have definition, observe in context with Employee class. Also try to instantiate abstract class object, abstract class pointer. 10) Derive class manager publicly from class Employee having Data abstraction: - Number of subordinates - Basic salary - Dearness Allowance Procedural Abstraction: - Default value constructor - Parameterized Constructor - AcceptInfo() - DisplayInfo() - ComputeSalary() - Destructor 11) Derive class SalesManager publicly from Salesperson and Manager

Procedural Abstraction: - Default value constructor - GetInfo() function to get information of SalesManager - AcceptInfo() - DisplayInfo() - ComputeSalary() - Destructor

12) Using virtual and pure virtual functions implement hierarchy of computer printers.

13 )rite a template function Sort to sort array of type char, int. 14)Write template class Stack and provide following facilities - push - pop - peep
15) Write a template class for sorting method. Using this class, write a test program for sorting using different data types. Also implement exception handling. 16) Create a text file using any simple editor. Write a program that will reverse each line in the input file and store it in another file. 17) Find the number of students who are passes or failed using MAP. 18) Find the prime numbers from 2 to n using sieves algorithm, use SET 19) Implement the Run time polymorphism using RTT 20) Create a class SingleTon whose only one object can be created.

* Make use of static function.


21) matrix: 1. addition 2. sub 3. multiplication

You might also like