// Lab oops, lab journal
// Programmer : Vaishnavi Tomar
// Editor(s) used : Code Blocks 13.12
// Compiler(s) used : Code Blocks 13.12
#include<iostream>
#include<string>
using namespace std;
class BankAccount {
private :
string name;
int accountNumber;
string accountType;
float balance;
float tariff;
int nod;
public :
void Checkin( int accNo, string accName, string accType, float initialBalance, float tariffRate,
int days) {
accountNumber = accNo;
name = accName;
accountType = accType;
balance = initialBalance;
tariff = tariffRate;
nod = days;
}
void deposit( float amount) {
balance + = amount;
cout << "Amount deposited successfully. New balance: " << balance << endl;
}
void withdraw( float amount) {
if ( balance >= amount) {
balance - = amount;
cout << "Amount withdrawn successfully. Remaining balance: " << balance << endl;
} else {
cout << "Insufficient balance. Transaction failed." << endl;
}
}
void display( ) const {
cout << "Depositor Name: " << name << endl;
cout << "Account Number: " << accountNumber << endl;
cout << "Account Type: " << accountType << endl;
cout << "Balance: " << balance << endl;
}
float calculateTotalAmount( ) const {
if ( balance > 10000 ) {
return 1.05 * balance;
} else {
return balance + ( nod * tariff) ;
}
}
} ;
int main( ) {
BankAccount account;
int accountNumber;
string name, accountType;
float initialBalance, tariffRate;
int nod;
cout << "Enter Account Number: " ;
cin >> accountNumber;
cin .ignore ( ) ;
cout << "Enter Name of Depositor: " ;
getline( cin , name) ;
cout << "Enter Account Type (Saving/Current): " ;
cin >> accountType;
cout << "Enter Initial Balance: " ;
cin >> initialBalance;
cout << "Enter Tariff Rate: " ;
cin >> tariffRate;
cout << "Enter Number of Days (NOD): " ;
cin >> nod;
account.Checkin ( accountNumber, name, accountType, initialBalance, tariffRate, nod) ;
account.deposit ( 5000 ) ;
account.withdraw ( 3000 ) ;
account.display ( ) ;
float totalAmount = account.calculateTotalAmount ( ) ;
cout << "Total amount considering tariff: " << totalAmount << endl;
return 0 ;
}
IC8vIExhYiBvb3BzLCBsYWIgam91cm5hbAovLyBQcm9ncmFtbWVyIDogVmFpc2huYXZpIFRvbWFyCi8vIEVkaXRvcihzKSB1c2VkIDogQ29kZSBCbG9ja3M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