0% found this document useful (0 votes)
10 views3 pages

C++ Class and Objects Example Programs Questions

The document outlines the creation of several C++ classes, including BankAccount, Employee, Student, Rectangle, ComplexNumber, Time, and Book. Each class has specific attributes and methods for functionality such as displaying information, updating values, and performing calculations. The document serves as a guideline for implementing object-oriented programming concepts in C++.

Uploaded by

Sekhar Muthangi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

C++ Class and Objects Example Programs Questions

The document outlines the creation of several C++ classes, including BankAccount, Employee, Student, Rectangle, ComplexNumber, Time, and Book. Each class has specific attributes and methods for functionality such as displaying information, updating values, and performing calculations. The document serves as a guideline for implementing object-oriented programming concepts in C++.

Uploaded by

Sekhar Muthangi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Write a c++ program for creating Bank Account Class

Create a BankAccount class with the following attributes:

- accountNumber (string)

- accountHolder (string)

- balance (float)

Implement the following methods:

- deposit(float amount)

- withdraw(float amount)

- displayBalance()

2. Write a c++ program for creating Employee Class

Create an Employee class with the following attributes:

- employeeId (int)

- name (string)

- salary (float)

Implement the following methods:

- getEmployeeDetails()

- updateSalary(float newSalary)

- displayEmployeeInfo()

3. Write a c++ program for creating Student Class

Create a Student class with the following attributes:

- rollNumber (int)

- name (string)

- marks (float)

Implement the following methods:

- getStudentDetails()

- updateMarks(float newMarks)

- displayStudentInfo()
4. Write a c++ program for creating Rectangle Class

Create a Rectangle class with the following attributes:

- length (float)

- width (float)

Implement the following methods:

- calculateArea()

- calculatePerimeter()

- displayRectangleInfo()

5. Write a c++ program for creating Complex Number Class

Create a ComplexNumber class with the following attributes:

- real (float)

- imaginary (float)

Implement the following methods:

- add(ComplexNumber other)

- subtract(ComplexNumber other)

- multiply(ComplexNumber other)

- displayComplexNumber()

6. Write a c++ program for creating Time Class

Create a Time class with the following attributes:

- hours (int)

- minutes (int)

- seconds (int)

Implement the following methods:

- addTime(Time other)

- subtractTime(Time other)

- displayTime()
7. Write a c++ program for creating Book Class

Create a Book class with the following attributes

- title (string)

- author (string)

- price (float)

Implement the following methods:

- getBookDetails()

- updatePrice(float newPrice)

- displayBookInfo()

You might also like