Sunday, May 30, 2021

simple program using classes and objects (OOP) (95)

#include<iostream>

using namespace std;

class Bank_Account

{

private:

string name_AH,account_num,CNIC,account_type,Balance_amount;

public:

Bank_Account(string a,string b,string c,string d,string e) //defaulat constructure

{

name_AH=a;

account_num=b;

CNIC=c;

account_type=d;

Balance_amount=e;

}

void accountype();

void deposite(string);

void withdraw();

void display();

};

void Bank_Account::accountype()

{

cout<<"please enter your account type here:";

cin>>account_type;

if(account_type="saving")

{

cout<<"you have been required to pay 1%"<<endl;

}

}

void Bank_Account::deposite(string d);

{

Balance_amount=d;

}

void Bank_Account::withdraw();

{

int withdraw;

cout<<"please enter your balance withdraw here:";

cin>>withdraw;

if(withdraw>50000)

{

withdraw=withdraw-2500;

Balance_amount=Balance_amount- withdraw;

}

}

void Bank_Account::display();

{

cout<<"name of the account holder:"<<name_AH<<endl;

cout<<"current balance:"<<Balance_amount<<"Dollar"<<endl;

}

int main()

{

Bank_Account obj1("hamza",1234,12345678,"any",8900);

obj1.accountype();

obj1.deposite(450000);

obj1.withdraw();

obj1.display();

} 

No comments:

Post a Comment