Object-Oriented Programming (oop) Codes

If the code doesn't load, you can check it out on GitHub

Group A

Q1: Implement a class Complex which represents the Complex Number data type: 1) Constructor (including a default constructor which creates the complex number 0 + 0i). 2) Overload operator + to add two complex numbers. 3) Overload operator * to multiply two complex numbers. 4) Overload operators << and >> to print and read Complex Numbers.


                

Q2: Develop a program in C++ to create a database of students information system containing the following information: Name, Roll number, Class, Division, Date of Birth, Blood group, Contact address, Telephone number, Driving license no. and others. Construct the database with suitable member functions. Make use of constructor, default constructor, copy constructor, destructor, static member functions, friend class, this pointer, inline code, and dynamic memory allocation operators (new and delete) as well as exception handling.


                

Q3: Imagine a publishing company that markets both book and audio cassette versions. Create a class called Publication that stores the title (a string) and price (a float) of the publications. From this class, derive two classes: Book, which adds a page_count attribute (an integer), and Tape, which adds a playing_time attribute in minutes (a float). Write a program that instantiates the Book and Tape classes, allows the user to enter data for each class, and then displays the data members. If an exception occurs, set all data member values to zero.


                

Group B

Q4: Write a C++ program that creates an output file, writes information to it, closes the file, opens it again as an input file, and reads the information from the file.


                

Q5: Write a function template for selection sort that inputs, sorts and outputs an integer array and a float array.


                

Group C

Q6: Write a C++ program using STL for sorting and searching user-defined records such as personal records (Name, DOB, Telephone number, etc.) using the vector container.


                

Group D

Q7: Write a C++ program to use the map associative container. The keys will be the names of states, and the values will be the populations of the states. When the program runs, the user is prompted to type the name of a state. The program then looks in the map, using the state name as an index, and returns the population of the state. Include error handling for cases where the state name does not exist in the map.