Skip to content

KumbidiK/CPP---Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PROGRAM LIST

  1. Write a program to define a class Car with attributes like brand, model, and year. Write member functions for the following.

    1. To read data members.
    2. To display car details Create three Car objects with different attributes and display details of each one.
  2. 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

    1. To input book details
    2. Display book details
    3. 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.
  3. 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.

  4. Write a C++ program to find the area of circle, square, rectangle and triangle using inline functions

  5. Write a C++ program to find area of circle, square, rectangle and triangle using function overloading

  6. 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

  7. Write a program to define a class Time having private members hours, minutes, and seconds. Write member functions

    1. To input values to data members
    2. To display Time in Hour:minute: second format. 3.
    3. To find the sum of two Time objects using a friend function.
  8. C++ program to illustrate the use of unary operator overloading, increment ++ operator overloading.

  9. Perform matrix addition using operator overloading

  10. 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.

  11. 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

  12. Write a c++ program to perform multiple inheritance

    Screenshot (18)
  13. 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.

  14. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages