A bank in your town updates its customers accounts at the en

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 <iostream>

using namespace std;

#include <iomanip>

#include <fstream>

#include <string>

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;

       }

   }

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 <iostream>

using namespace std;

#include <iomanip>

#include <fstream>

#include <string>

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;

       }

   }

Solution

# include<iostream.h>

#include<fstream>

#include<string>

#include<iomanip>

double bank(char, float, float);

int main()

{

ifstream myfile();

myfile.open(\"infile.txt\");

int accnum;

ifstream myfile

int acctnum;

char accttype;

float minbalance;

floatcurrentbalance;

int acctnum2;

char accttype2;

int minbal2;

int currentbalance2;

float saving_charge;

   float checking_charge;

   float service_charge;

if (CurrentBalance < minBalance) {

       if (accttype == \'S\')

           return service_charge = CurrentBalance - saving_charge;

   }

   if (CurrentBalance < minBalance) {

       if (accttype == \'C\')

           return service_charge = CurrentBalance - saving_charge;

   }

}

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

       float saving_int = 0.04;

       float checking_int = 0.05;

       float rate;

       if (acctype == \'S\')

       {

           if (CurrentBal < minBal)

               return rate = (CurrentBal*0.04) + CurrentBal;

       }

   if (accttype == \'C\')

   {

           if (CurrentBal ance< minBalance)

               if (CurrentBalance<= (minBalance + 5000.00))

                   return rate = (CurrentBalance *0.03) + CurrentBalance;

       }

   }

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
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
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
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
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
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
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
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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site