Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello my C + + program wontt run & i can figure out why. Could you help me #include #include using namespace std; int readAccountNo

Hello my C++ program wontt run & i can figure out why. Could you help me
#include
#include
using namespace std;
int readAccountNo(){
int accNo;
do {
cout << "Enter an account number (even, positive, less than 10000): ";
cin >> accNo;
} while (accNo %2!=|| accNo <=|| accNo >=10000);
return accNo;
}
double readBalanceAmount(){
double balance;
do {
cout << "Enter the opening balance amount ($1- $200000): ";
cin >> balance;
} while (balance <1|| balance >200000);
return balance;
}
double calculateDeposit(double balance){
double deposit;
cout << "Enter the amount to deposit: ";
cin >> deposit;
return balance + deposit;
}
double addReturnBonus(double openingBalance){
double bonusPercentage =3.5;
double bonus =(bonusPercentage /100)* openingBalance;
return openingBalance + bonus;
}
void printAllInfo(int accNo1, double balance1, int accNo2, double balance2, int accNo3, double balance3, int accNo4, double balance4){
cout << fixed << setprecision(2);
cout << "Account Balances for All Accounts:" << endl;
cout << "Account Number: "<< accNo1<<"\tBalance: $"<< balance1<< endl;
cout << "Account Number: "<< accNo2<<"\tBalance: $"<< balance2<< endl;
cout << "Account Number: "<< accNo3<<"\tBalance: $"<< balance3<< endl;
cout << "Account Number: "<< accNo4<<"\tBalance: $"<< balance4<< endl;
}
int main(){
cout << "Developer's Details:" << endl;
for (int i =1; i <=3; i++){
cout << "Name: [Your Name]"<< endl;
cout <<"CPS 171 Section: [Your Section]"<< endl;
cout << "Due Date: [Due Date]"<< endl;
}
int account1, account2, account3, account4;
double balance1, balance2, balance3, balance4;
cout << "Enter data for 4 customers:" << endl;
for (int i =1; i <=4; i++){
cout << "For customer "<< i <<":"<< endl;
if (i ==1){
account1= readAccountNo();
balance1= readBalanceAmount();
} else if (i ==2){
account2= readAccountNo();
balance2= readBalanceAmount();
} else if (i ==3){
account3= readAccountNo();
balance3= readBalanceAmount();
} else {
account4= readAccountNo();
balance4= readBalanceAmount();
}
}
balance1= addReturnBonus(balance1);
balance2= addReturnBonus(balance2);
balance3= addReturnBonus(balance3);
balance4= addReturnBonus(balance4);
char choice;
do {
cout << "Main Menu:" << endl;
cout <<"A- Do deposit" << endl;
cout <<"B- View accounts" << endl;
cout <<"C- Exit the program" << endl;
cout << "Enter your choice: ";
cin >> choice;
switch(choice){
case 'A':
cout << "Select an account to do a deposit:" << endl;
// Implement deposit functionality for selected account
break;
case 'B':
printAllInfo(account1, balance1, account2, balance2, account3, balance3, account4, balance4);
break;
case 'C':
cout << "Exiting the program. Goodbye!" << endl;
break;
default:
cout << "Invalid option. Please choose a valid option (A, B, or C)."<< endl;
}
} while(choice !='C');
return ;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visualizing Health And Healthcare Data Creating Clear And Compelling Visualizations To See How Youre Doing

Authors: Katherine Rowell ,Lindsay Betzendahl ,Cambria Brown

1st Edition

1119680883, 978-1119680888

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago