0% found this document useful (0 votes)
20 views14 pages

Oop Project of 40,46

oop project

Uploaded by

barraengineer027
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)
20 views14 pages

Oop Project of 40,46

oop project

Uploaded by

barraengineer027
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
You are on page 1/ 14

CRUD Report

Semester: 5 th( R )

Department : BS . CS

Submitted by: Mian Hamad Saeed(221746)

Submitted to: Sir Murad

Source Code:
#include <iostream>

#include <vector>

#include <string>

using namespace std;

class BankAccount {

public:

int accountNumber;

string accountHolder;

double balance;

// Constructor

BankAccount(int accNumber, const string& accHolder, double initialBalance)

: accountNumber(accNumber), accountHolder(accHolder), balance(initialBalance) {}

// Member functions

void deposit(double amount) {

balance += amount;

cout << "Amount deposited successfully!" << endl;

void withdraw(double amount) {

if (amount <= balance) {

balance -= amount;

cout << "Amount withdrawn successfully!" << endl;

} else {

cout << "Insufficient balance!" << endl;

void displayBalance() const {

cout << "Account Holder: " << accountHolder << endl;

cout << "Account Balance: " << balance << endl;

}
void displayAccountDetails() const {

cout << accountNumber << "\t\t" << accountHolder << "\t\t" << balance << endl;

};

class BankManagementSystem {

private:

vector<BankAccount> accounts;

public:

int getAccountIndex(int accountNumber) {

for (int i = 0; i < accounts.size(); ++i) {

if (accounts[i].accountNumber == accountNumber) {

return i;

return -1;

void createAccount() {

int accNumber;

string accHolder;

double initialBalance;

cout << "Enter account number: ";

cin >> accNumber;

cout << "Enter account holder name: ";

cin.ignore();

getline(cin, accHolder);

cout << "Enter initial balance: ";

cin >> initialBalance;

BankAccount newAccount(accNumber, accHolder, initialBalance);

accounts.push_back(newAccount);

cout << "Account created successfully!" << endl;


}

void performTransaction(const string& action) {

int accountNumber;

double amount;

cout << "Enter account number: ";

cin >> accountNumber;

int accountIndex = getAccountIndex(accountNumber);

if (accountIndex != -1) {

cout << "Enter amount to " << action << ": ";

cin >> amount;

if (action == "deposit") {

accounts[accountIndex].deposit(amount);

} else if (action == "withdraw") {

accounts[accountIndex].withdraw(amount);

} else {

cout << "Account not found!" << endl;

void balanceInquiry() {

int accountNumber;

cout << "Enter account number: ";

cin >> accountNumber;

int accountIndex = getAccountIndex(accountNumber);

if (accountIndex != -1) {

accounts[accountIndex].displayBalance();

} else {

cout << "Account not found!" << endl;

}
}

void accountHolderList() {

cout << "----- Account Holder List -----" << endl;

cout << "Account No.\tAccount Holder\tBalance" << endl;

for (int i = 0; i < accounts.size(); ++i) {

accounts[i].displayAccountDetails();

cout << "--------------------------------" << endl;

void closeAccount() {

int accountNumber;

cout << "Enter account number: ";

cin >> accountNumber;

int accountIndex = getAccountIndex(accountNumber);

if (accountIndex != -1) {

accounts.erase(accounts.begin() + accountIndex);

cout << "Account closed successfully!" << endl;

} else {

cout << "Account not found!" << endl;

void modifyAccount() {

int accountNumber;

cout << "Enter account number: ";

cin >> accountNumber;

int accountIndex = getAccountIndex(accountNumber);


if (accountIndex != -1) {

cout << "Enter new account holder name: ";

cin.ignore();

getline(cin, accounts[accountIndex].accountHolder);

cout << "Account modified successfully!" << endl;

} else {

cout << "Account not found!" << endl;

};

int main() {

BankManagementSystem bankSystem;

int choice;

while (true) {

cout << "----- Bank Management System -----" << endl;

cout << "1. New Account" << endl;

cout << "2. Deposit Amount" << endl;

cout << "3. Withdraw Amount" << endl;

cout << "4. Balance Inquiry" << endl;

cout << "5. All Account Holder List" << endl;

cout << "6. Close an Account" << endl;

cout << "7. Modify an Account" << endl;

cout << "8. Exit" << endl;

cout << "Enter your choice: ";

cin >> choice;

switch (choice) {

case 1:

bankSystem.createAccount();

break;

case 2:

bankSystem.performTransaction("deposit");

break;
case 3:

bankSystem.performTransaction("withdraw");

break;

case 4:

bankSystem.balanceInquiry();

break;

case 5:

bankSystem.accountHolderList();

break;

case 6:

bankSystem.closeAccount();

break;

case 7:

bankSystem.modifyAccount();

break;

case 8:

cout << "Exiting... Thank you!" << endl;

return 0;

default:

cout << "Invalid choice! Please try again." << endl;

cout << endl << endl << endl;

Flow chart
OOP PROJECT

Semester: 3 rd

Department : BS . CS

Project name: Bank Management System

Project members: Barra Fatima 221740


Mian Hamad Saeed
221746

Submitted to: Prof Sami -ul-llah

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy