Hi everyone,i really need help for my assignment.Please help me, i need to hand in my assignment on this Sunday.
This is my assignment required:
The display a table that forecasts the balance every month for the term of each account. Calculate each month’s balance as follows:
Calculate interest earned on the starting balance; interest earned is 1/12 of the annual interest rate times the starting balance.
Add the monthly automatic deposit.
Subtract the monthly automatic withdrawal.
Display the year number, month number, month-starting balance, and month-ending balance.
for example:
if first month balance is 600
ending balance is 605
the next month starting balance should be 605
I do the first month and second month, but for the third, four, five to 12, I cant change the balance anymore.
This is my code:
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
struct BankAccount
{
int acc_Num;
int acc_Balance;
float acc_Deposit;
float acc_Withdrawal;
double acc_InterestRates;
double customerPassword;
string customerName;
};
int main ()
{
BankAccount accountOne;
BankAccount accountTwo;
string customerName = "David";
int customerPassword;
void TwoAcc_detail();
{
customerName=new char[20];
cout<<endl<<endl<<"**********Customer Details*********** "<<endl;
cout<<" -------- ------- "<<endl;
cout<<"Enter Name: ";
cin>>customerName;
cout<<"Password number must be four digits"<<endl;
cout<<"Enter Password: ";
cin>>customerPassword;
tryAgain://this is a statement label
cout<<endl<<endl<<"-------First account -------"<<endl;
cout<<"Enter Account number: ";
cin>>accountOne.acc_Num;
if (accountOne.acc_Num>=1000 && accountOne.acc_Num<=9999)
cout<<"Your account numbers is correct"<<endl;
else
{
cout<<"Account number must between 1000 and 9999"<<endl;
cout<<"Please try again, enter your account number is: ";
cin>>accountOne.acc_Num;
}
cout<<"Enter bank account balance:$ ";
cin>>accountOne.acc_Balance;
if(accountOne.acc_Balance>0 && accountOne.acc_Balance<100000)
cout<<"Your balance is correct"<<endl;
else
{
cout<<"Please try again, enter your account balance is: ";
cin>>accountOne.acc_Balance;
}
cout<<"Enter interest rate: ";
cin>>accountOne.acc_InterestRates;
if(accountOne.acc_InterestRates>=0.0001 && accountOne.acc_InterestRates<=0.15)
cout<<"The interest Rates is in process"<<endl;
else
{
cout<<"Error"<<endl;
system ("pause");
return 0;
}
cout<<"The Final balance is: "<<accountOne.acc_Balance+accountOne.acc_Balance*accountOne.acc_InterestRates<<endl;
cout<<endl<<endl<<"-------Second account -------"<<endl;
cout<<"Enter Account number: ";
cin>>accountTwo.acc_Num;
if (accountTwo.acc_Num>=1000 && accountTwo.acc_Num<=9999)
cout<<"Your account numbers is correct"<<endl;
else
{
cout<<"Account number must between 1000 and 9999"<<endl;
cout<<"Please try again, enter your account number is: ";
cin>>accountTwo.acc_Num;
}
cout<<"Enter bank account balance:$ ";
cin>>accountTwo.acc_Balance;
if(accountTwo.acc_Balance>0 && accountTwo.acc_Balance<100000)
cout<<"Your balance is correct"<<endl;
else
{
cout<<"Please try again, enter your account balance is: ";
cin>>accountTwo.acc_Balance;
}
cout<<"Enter interest rate: ";
cin>>accountTwo.acc_InterestRates;
if(accountTwo.acc_InterestRates>=0.0001 && accountTwo.acc_InterestRates<=0.15)
cout<<"The interest Rates is in process"<<endl;
else
{
cout<<"Error"<<endl;
system ("pause");
return 0;
}
cout<<"The Final balance is: "<<accountTwo.acc_Balance+accountTwo.acc_Balance*accountTwo.acc_InterestRates<<endl;
cout<<endl<<endl<<"-------Deposit account------"<<endl;
float dollars;
float cents;
cout << "How much money you want to be deposited in the first account for every month: ";
cin>>accountOne.acc_Deposit;
dollars = accountOne.acc_Deposit;
cents = modf(accountOne.acc_Deposit,&dollars)*100;
cout << dollars << " dollars and " << cents << " cents";
cout<<endl<<endl<<"-----------------------------------"<<endl;
cout << "How much money you want to be deposited in the second account for every month: ";
cin>>accountTwo.acc_Deposit;
dollars = accountTwo.acc_Deposit;
cents = modf(accountTwo.acc_Deposit,&dollars)*100;
cout << dollars << " dollars and " << cents << " cents";
cout<<endl<<endl<<"-------Withdrawal------"<<endl;
cout << "How much money you want to be withdrawal in the first account for every month: ";
cin>>accountOne.acc_Withdrawal;
dollars = accountOne.acc_Withdrawal;
cents = modf(accountOne.acc_Withdrawal,&dollars)*100;
cout << dollars << " dollars and " << cents << " cents";
cout<<endl<<endl<<"-----------------------------------"<<endl;
cout << "How much money you want to be withdrawal in the second account for every month: ";
cin>>accountTwo.acc_Withdrawal;
dollars = accountTwo.acc_Withdrawal;
cents = modf(accountTwo.acc_Withdrawal,&dollars)*100;
cout << dollars << " dollars and " << cents << " cents";