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

CPP1

1. The document describes 5 programming tasks: 1) Create a Distance class that can add feet and inches and display the total. 2) Create a BankAccount class to store customer data and perform deposits, withdrawals, and balance checks. 3) Write a program using a Stack class with push, pop, and display functions. 4) Demonstrate static variables and functions by counting objects and displaying the count. 5) No details provided for this task.

Uploaded by

pallikachopra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

CPP1

1. The document describes 5 programming tasks: 1) Create a Distance class that can add feet and inches and display the total. 2) Create a BankAccount class to store customer data and perform deposits, withdrawals, and balance checks. 3) Write a program using a Stack class with push, pop, and display functions. 4) Demonstrate static variables and functions by counting objects and displaying the count. 5) No details provided for this task.

Uploaded by

pallikachopra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Student Test 1.

Create a class Distance, which accepts data in feet and inches adds two distances and displays the members of the distance object in the appropriate form. Test the class in the main program by creating object d1 and d2 of type distance, accept data for each object and add them then display them.
2.

Define a class to represent Bank account. Include the following members. Data members (1) Name of depositor (2) Account number (3) Type of account (4) Balance member functions (a) To assign initial values (b) To deposit an amount in a particular account (c) To withdraw an amount after checking the balance (d) To display name and balance Write a main program to test the class for handling 10 customers. Write a program to implement the push and pop functions of a stack using a class Stack. Also make use of a private member function display() to display contents of the stack after every push and pop operations. Create a member function init() to initialize top of the stack. Demonstrate the use of static variables and static function in a class by using it to count the number of objects created in the program, having a static function to display the count.

3.

4.

5.

You might also like