I hsve developed this code I am having trouble with the Account manager to perform the task it meant to do when i put N for New customer it exits the program and i shouldnt can anyone hepl me with this problem
#include <iostream>
#include <string>
#include <cmath>
#include <time.h>
using namespace std;
int menuvalue;
int isDone;
string Name;
int Age;
long PostCode;
string Address;
string dob;
string telnum;
int Money;
int Deposits;
int Withdraw;
int Transfer;
int uinput;
char dateStr [9];
char timeStr [9];
float LOAN_AMOUNT=0;
float INT_RATE=0;
int TERM_YEARS=0;
char quit;
float RATE;
float monthlyInterestRate;
int length_in_months = 12;
int numberOfPayments;
float monthlyPaymentAmt;
int monthly_payments_counter;
float loanBalance;
float monthlyIntPymt;
int divide_list = 0;
char list_more;
float monthlyPrincipalPymt;
int main()
{
cout << "1. Go to Mortage Calc\n";
cout << "2. Go to Account Manager\n";
cout << "3. Exit\n";
cin >> menuvalue;
if (menuvalue == 1)
{
cout << "Welcome to Mortgage Calulator\n";
do
{
//output message asking for loan amt
cout<<"Input the total loan amount:\n";
//input data
cin>>LOAN_AMOUNT;
//output message asking for interest rate
cout<<"Input the annual interest rate:\n";
//input data
cin>>INT_RATE;
//output message asking for term in years of loan
cout<<"Input the length of the loan in years:\n";
//input data
cin>>TERM_YEARS;
//CALCULATIONS
//rate in decimal format
RATE = INT_RATE / 100;
//number of payments
numberOfPayments = TERM_YEARS * length_in_months;
//monthly interest rate
monthlyInterestRate = RATE / length_in_months;
//monthly payments
monthlyPaymentAmt = (LOAN_AMOUNT*
pow(monthlyInterestRate + 1, numberOfPayments)
* monthlyInterestRate)/(pow(monthlyInterestRate + 1,
numberOfPayments) - 1); //pow returns x raised to the power of y
//output results
//cout<<fixed<<setprecision(2)//cout writes text to the screen
cout<<"Your monthly payment for "
<<TERM_YEARS <<" years\n";
cout<<"for an Interest Rate of "
<<INT_RATE <<"%\n";
cout<<"on a Loan Amount of $"
<<LOAN_AMOUNT <<" is $"<<monthlyPaymentAmt<<" a month\n";
cout<<"\n";
cout<<"Payment Number\tLoan Balance\tInterest Paid\n";
cout<<"--------------\t------------\t-------------\n";
//List the payment number, loan balance, and interest paid
//for each period
for (monthly_payments_counter=1; monthly_payments_counter<=numberOfPayments; ++monthly_payments_counter)
{
monthlyIntPymt = loanBalance * monthlyInterestRate;
monthlyPrincipalPymt = monthlyPaymentAmt - (loanBalance * INT_RATE);
loanBalance = loanBalance - monthlyPrincipalPymt;
//displays a partial list and allows the user either continue viewing
//the list, enter a new loan, or exit the program
if (divide_list == 12)
{
cout <<"Type 'c' to continue viewing the list, "
<<"'n' to enter a new loan, or 'e' to exit: ";
cin >> list_more;
if ((list_more == 'c') || (list_more == 'C'))
divide_list = 0;
else if ((list_more == 'n') || (list_more == 'N'))
break;
else if ((list_more == 'e') || (list_more == 'E'))
return 0;
}
//displays the results on the screen for each payment number
cout<<monthly_payments_counter<<"\t\t"
<<loanBalance<<"\t"
<<monthlyIntPymt<<"\t\t\n";
++divide_list;
}
//user can continue in a loop or quit
//output
cout<<"\n";
cout<<"Enter C to continue, Q to quit >";
//user input
cin>>quit;
cout<<"\n";
}
while (((quit!= 'q') && (quit!= 'Q')) || ((quit == 'c') && (quit == 'C')));
cout<<"Thanks for using the calculator!\n";
}
if (menuvalue == 2)
{
cout << "Welcome to Account Manager\n";
cout << "\nN to Create a new account";
cout << "\nD to Deposit";
cout << "\nV to View Account Information";
cout << "\nL to List All Accounts";
cout << "\nW to Withdraw";
cout << "\nE to Exit\n";
cin >> uinput;
if(uinput == 'N' || uinput == 'n')
{
cout << "Please Enter Customers Full Name ";
cin >> Name;
cout << "Please Enter Customers Age ";
cin >> Age;
cout << "Please Enter Customers Date of Birth ";
cin >> dob;
cout << "Please Enter Customers First Line of Address ";
cin >> Address;
cout << "Please Enter Customers Post Code ";
cin >> PostCode;
cout << "Please Enter Customers Telephone Number ";
cin >> telnum;
}
if (uinput== 'D' || uinput == 'd')
{
int aDep;
cout << "\nEnter a deposit amount: $";
cin >> aDep;
Money = Money + aDep;
Transfer = Transfer + aDep;
Deposits = Deposits + 1;
cout << "\nAmount Deposited: $" << aDep;
cout << "\nBalance: $" << Money;
//PrintSpace();
}
if(uinput == 'W' || uinput == 'w')
{
int aWith;
cout << "Enter a withdrawl amount: $";
cin >> aWith;
//check amounts
if (aWith > Money)
{
cout << "Sorry, your account only has $" << Money << " dollars\n";
//PrintSpace();
}
else
{
Money = Money - aWith;
Transfer = Transfer - aWith;
cout << "Amount Withdrawn: $" << aWith << "\n";
Withdraw = Withdraw + 1;
cout << "Balance: $" << Money << "\n";
//PrintSpace();
}
}
if (uinput =='V' || uinput=='v')
{
Transfer = Deposits + Withdraw;
cout << "\n\n***Account Information***";
cout << "\nTotal Balance: $" << Money;
cout << "\nTotal Transactions: " << Transfer;
_strdate(dateStr);
cout << "The date of transaction is is %s " << dateStr;
_strtime(timeStr);
cout << "The time of Transation is %s " << timeStr;
cout << "\nTotal Deposits: " << Deposits;
cout << "\nTotal Withdrawls: " << Withdraw;
//PrintSpace();
}
if(uinput == 'L' || uinput == 'l')
{
cout << "List displayed below of all account assoiated with Agroup Bank";
cout << "Customers Name: " << Name;
cout << "Customers Age: " << Age;
cout << "Customers Date of Birth: " << dob;
cout << "Customers Address: " << Address;
cout << "Customers Post Code " << PostCode;
cout << "Customers Telelphne Number: " << telnum;
}
if (uinput=='E' || uinput=='e')
{
isDone = 1;
//PrintSpace();
}
if (menuvalue == 3)
{
exit(0);
}
return 0;
}
};