Beruflich Dokumente
Kultur Dokumente
#define ACCOUNT_H
#include <string>
#include <iostream>
class Account {
public:
Account(){
accountNumber = 0;
balance = 0;
};
Account(int account, double bal);
void withdraw(double amount);
void deposit(double amount);
double balanceRequest();
void print();
double fee(bool fee);
bool accountN(int stuff);
private:
int accountNumber;
double balance;
};
#endif ACCOUNT_H
#include "account.h"
void Account::print(){
cout << "Your account number is " << accountNumber << ".\n";
cout << "Your balance is " << balance << ".\n";
}
double Account::balanceRequest(){
return balance;
}
if (stuff == accountNumber)
return true;
else
return false;
#include "Account.h"
#include <string>
#include <iostream>
/*
int main(){
account1.print();
account2.print();
return 0;
}
*/
int main(){
Account();
Account account1(1114, 10000);
Account account2(1116, 9586);
Account account3(1115, 1000);
int input, accountNum, accountNum2;
bool more = false;
double amount;
cout << "Please enter your account number.\n";
cin >> accountNum;
Account n, b;
if (account1.accountN(accountNum)){
n = account1;
more = true;
}
else if (account2.accountN(accountNum)){
n = account2;
more = true;
}
else if (account3.accountN(accountNum)){
n = account3;
more = true;
}
if (account1.accountN(accountNum) || account2.accountN(accountNum) ||
account3.accountN(accountNum)){
while (more){
cout << "Please enter a selection from the items below.\n1.
Balance\n2. Withdraw \n3. Deposit \n4. Exit\n\n";
cin >> input; cout << endl;
switch (input)
{
case 1: cout << "Your balance is $" << n.balanceRequest() <<
".\n\n"; break;
case 2: cout << "Enter amount to withdraw.\n\n"; cin >> (amount);
n.withdraw(amount); break;
case 3: cout << "Enter amount to deposit\n\n"; cin >> amount;
n.deposit(amount); break;
case 4: more = false; break;
default: "Please enter a valid selection.\n"; break;
}
}
}
else
cout << "Not a valid account\n";
if (account1.accountN(accountNum)){
n = account1;
}
else if (account2.accountN(accountNum)){
n = account2;
}
else if (account3.accountN(accountNum)){
n = account3;
}
if (account1.accountN(accountNum) || account2.accountN(accountNum) ||
account3.accountN(accountNum)){
transfer(n, account2, 100);
}
cout << n.balanceRequest();
cout << account2.balanceRequest();
return 0;
}