[Lab Exercise] Classes and Objects


Submit solution

Points: 10
Time limit: 0.5s
Memory limit: 2M

Author:
Problem type
Allowed languages
C++

Problem Statement

Create a class named BankAccount with private attributes for the account holder's name, account number, and balance. Include member functions to deposit money, withdraw money, and display the current balance. Ensure that the balance cannot go below zero during a withdrawal.

Write a program to demonstrate the usage of the BankAccount class by creating instances, set Account Name, Account Number, and Balance. Performing deposit and two withdrawals, and displaying the account information.

Test Data

Input 1

Ramaguru
123456789
1000.0
500.0
200.0
1500.0

Output 1

Account Holder: Ramaguru
Account Number: 123456789
Current Balance: ₹1000
Deposited ₹500 into the account.
Withdrawn ₹200 from the account.
Insufficient balance or invalid withdrawal amount.
Account Holder: Ramaguru
Account Number: 123456789
Current Balance: ₹1300

Input 2

Ramaguru
123456789
1000.0
500.0
200.0
1200.0

Output 2

Account Holder: Ramaguru
Account Number: 123456789
Current Balance: ₹1000
Deposited ₹500 into the account.
Withdrawn ₹200 from the account.
Withdrawn ₹1200 from the account.
Account Holder: Ramaguru
Account Number: 123456789
Current Balance: ₹100


Comments


  • 0
    cbenu4cys22049  commented on Aug. 22, 2023, 10:52 a.m. edited

    include<iostream>

    using namespace std; cout<<"Hello World"<<endl; return 0; }