PROGRAM LIST
-
Write a program to define a class Car with attributes like brand, model, and year. Write member functions for the following.
- To read data members.
- To display car details Create three Car objects with different attributes and display details of each one.
-
Write a program to define a class Book with the private members: BookID, BookName, BookPrice, and total_cost() to calculate total cost for the number of copies, where n is passed as an argument. Write public members
- To input book details
- Display book details
- To input the number of copies required and display the Total cost to be paid. Create 3 Book objects and calculate the Total cost to be paid for each purchase.
-
Write a program to create a Rectangle class with two private data members: length and width. Create a default constructor that initialises both members to 0 and a parameterized constructor. Create two different objects of class Rectangle using these different types of constructors and display their values using a member function. Write a destructor that prints a message when an object is destroyed.
-
Write a C++ program to find the area of circle, square, rectangle and triangle using inline functions
-
Write a C++ program to find area of circle, square, rectangle and triangle using function overloading
-
Write a C++ program to implement a telephone bill class with Name, Address, Tel. No., No. of calls as data members. Compute the amount to be paid if the charges per call is Rs. 2/-. using friend function
-
Write a program to define a class Time having private members hours, minutes, and seconds. Write member functions
- To input values to data members
- To display Time in Hour:minute: second format. 3.
- To find the sum of two Time objects using a friend function.
-
C++ program to illustrate the use of unary operator overloading, increment ++ operator overloading.
-
Perform matrix addition using operator overloading
-
Create a base class Person with data members name and age, and a member function display().Derive a class Student from Person that adds a data member roll_number and a member function showDetails(). Demonstrate single inheritance by creating an object of the Student class and calling both base and derived class functions.
-
Write a program to create a base class BankAccount with attributes like account_number and balance, and functions deposit() and withdraw(). Derive two classes: 1. SavingsAccount with data member rate_of_interst and an additional function calculateInterest() and display it. 2. CurrentAccount, which requires maintaining a minimum balance and an additional function to calculate servicecharge() and reduce it from the balance, and display the details.
Demonstrate inheritance by performing operations on objects of both derived -
Write a c++ program to perform multiple inheritance
-
Write a C++ program to explain virtual functions by creating a base class c_polygon, which has a virtual function area(). Two classes, c_rectangle and c_traingle, are derived from c_polygon, and these classes have area() to calculate and return the area of a rectangle and a triangle, respectively.
-
Write a C++ program to define a class Student with data members Name, Rollno, and Course. Derive a class Test from a student with data members as marks in 3 subjects. Derive a class GraceMarks from a student with a data member BonusMark. Derive a class result from both Test and Gracemarks and calculate the Total marks. Display the result with all the details. Use the concept of a Virtual base class.