I need help with my code. I'm really bad at c++. Please help me validate this code.the account number should be between 1000 and 9999.should issue a error message and exit.bank balance should not be negative.should show error message and exit.the program should do the following..
Prompt the user for a dollar amount to be transferred from the first account to the second account. Issue an error message if the two accounts have the same account number, and do not carry out the transfer of funds.
Issue an error message if the requested transfer causes the first account to fall below $0.00, and do not make the transfer.
Issue a warning message if the transfer causes the balance in the first account to drop below $10.00, but make the transfer.
Issue a warning message if the transfer causes the balance in the second account to be greater than $100,000.00, which is the highest amount that is federally insured.
Display the ending balances after the transfer amount has been deducted from the first account and added to the second.
For now, when an error message is issued, the program should terminate gracefully. For warning messages, the program continues to execute.
Pleaseee.. help meee..Also i'm not allowed to use classes just yet..and i'm suposed to use loops for validation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include <iostream>
#include <string>
using namespace std;
struct BankAccount
{
int acc_Num;
double acc_Balance;
string cust_Name;
int pin;
};
int main()
{
BankAccount accountOne;
BankAccount accountTwo;
string username = "safra";
int adminPin = 1234;
int select;
cout<< "------------**Interbanking Application**-------------" << endl << endl;
cout << "-------Registerd Users Only--------" << endl << endl;
cout << "Enter username" << endl;
cin>> username;
cout << "Enter password" << endl;
cin>> adminPin;
cout << "-----Create new account-----"<< endl;
cout << "Enter bank account number: "<<endl;
cin >> accountOne.acc_Num;
cout << "Enter bank account balance: $"<<endl;
cin >> accountOne.acc_Balance;
cout << "Enter customer name: "<<endl;
cin >> accountOne.cust_Name;
cout << "Enter new pin: "<<endl;
cin >> accountOne.pin;
cout<<"------Enter Details for Account Two------"<<endl;
cout << "Enter bank account number: "<<endl;
cin >> accountTwo.acc_Num;
cout << "Enter bank account balance: $"<<endl;
cin >> accountTwo.acc_Balance;
cout << "Enter customer name: "<<endl;
cin >> accountTwo.cust_Name;
cout << "Enter new pin: "<<endl;
cin >> accountTwo.pin;
while (!(acc_Num <= 9999 && acc_Num >=1000))
{
cout<<"Incorrect Account Number."<<endl
"Please note that account numbers should be between 1000 and 9999."<<endl"Exiting now.."<<endl;
}
system("PAUSE");
}
|