Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A bank in your town updates its customers' accounts at the end of each month. The bank offers two types of accounts: savings and checking.

A bank in your town updates its customers' accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance. If a customer's balance falls below the minimum balance, there is a service charge of $10.00 for savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows:

a. Savings accounts receive 4% interest.

b. Checking accounts with balances of up to $5,000 more than the minimum balance receive 3% interest; otherwise, the interest is 5%.

Write a program that reads a customer's account number (int type), account type (char s for savings, c for checking), minimum balance that the account should maintain, and current balance. The program should then prints a report with (1) an appropriate heading and (2) that shows the account number, account type, and current balance for each customer in the file.

Write a program that reads a customer's account number (int type), account type (char s for savings, c for checking), minimum balance that the account should maintain, and current balance. The program should then prints a report with (1) an appropriate heading and (2) that shows the account number, account type, and current balance for each customer in the file.

Test your program by running it on the five accounts, using the following data file name "infile.txt":

?

1

2

3

4

5

46728 S 1000 2700

87324 C 1500 7689

79873 S 1000 800

89832 C 2000 3000

98322 C 1000 750

****************************************

Account Number: 46728

Account Type: Savings

Account Balance: $2808.00

****************************************

Account Number: 87324

Account Type: Checking

Account Balance: $8073.45

****************************************

Account Number: 79873

Account Type: Savings

Account Balance: $790.00

****************************************

Account Number: 89832

Account Type: Checking

Account Balance: $3090.00

****************************************

Account Number: 98322

Account Type: Checking

Account Balance: $725.00

i thought i solved the problem using this code but when i tryed to output i get nan-

and also i get errors saying not all control paths return a value how do i fix my code for the given problem code must be done in c++

#include

using namespace std;

#include

#include

#include

double compute_service(char, float, float);

double compute_int(char, float, float);

int main() {

//function calls and files in main

ifstream myfile;//Declare file input object

myfile.open("infile.txt");

int accnum;

char acctype;

int minBal;

int CurrentBal;

int accnum2;

char acctyp2;

int minbal2;

int CurrentBa2;

myfile >> accnum >> acctype >> minBal >> CurrentBal;

double service_charge1 = compute_service(acctype, minBal, CurrentBal);

double rate1 = compute_int(acctype, minBal, CurrentBal);

cout << fixed << showpoint;

cout << rate1;

}

double compute_service(char acctype, float minBal, float CurrentBal) {

float saving_charge;

float checking_charge;

float service_charge;

if (CurrentBal < minBal) {

if (acctype == 'S')

return service_charge = CurrentBal - saving_charge;

}

if (CurrentBal < minBal) {

if (acctype == 'C')

return service_charge = CurrentBal - saving_charge;

}

}

double compute_int(char acctype, float minBal, float CurrentBal) {

float saving_innt = 0.04;

float checking_int = 0.05;

float rate;

if (acctype == 'S')

{

if (CurrentBal < minBal)

return rate = (CurrentBal*0.04) + CurrentBal;

}

if (acctype == 'C')

{

if (CurrentBal < minBal)

if (CurrentBal <= (minBal + 5000.00))

return rate = (CurrentBal *0.03) + CurrentBal;

}

}

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

1.what is rule of law? 2.The administrative body of government?

Answered: 1 week ago