hello!! So this is my CIS assignment, my professor is very hard to understand and he expects us to be perfect lol. I have tried to run this problem with a code but as you can see he wants to see that when the program is ran, all of the outcomes are listed all at once, the code that I have does meet the math part when it comes to the answers but as I said it does not show me all of my answers listed if not I have to put all of the inputs. also professor wants to see two different outcomes for example
income balance=-100
he wants to see income=nnnn
number of checks
bank fee=nnnn
in other words he wants to see me putting the income but he wants to see an additional.... (as part of the outcome)
I am really sorry but I have tried to go to tutoring and the time for me does not work......
A bank charges $10 per month plus the following check fees for a commercial checking account: $0.10 each for fewer than 20 checks $0.08 each for 20-39 checks $0.06 each for 40-59 checks $0.04 each for 60 or more checks The bank also charges an extra $15.00 if the balance of the account falls below $400 (before any check fees are applied). Write a program that asks for the beginning balance and the number of check written. Compute and display the bank's service fees for the month. Input Validation: Do not accept a negative value for the number of checks written. If a negative value is given for the beginning balance, display an urgent message indicating the account is overdrawn. The transaction data file: transaction.txtPreview the documentPreview the document Output: Beginning balance: $-100 Number of checks written: 30 Your account is overdrawn! The bank fee this month is $27.40 Beginning balance: $400.00 Number of checks written: -20 Number of checks must be zero or more. Beginning balance: $300.00 Number of checks written: 36 The bank fee this month is $27.88 Beginning balance: $300.00 Number of checks written: 47 The bank fee this month is $27.82 Beginning balance: $350.00 Number of checks written: 5 The bank fee this month is $25.50 Beginning balance: $300.00 Number of checks written: 70 The bank fee this month is $27.80
Reading data from a file
# include <iostream>
# include <iomanip>
# include <fstream>
using namespace std;
std; int main()
{ ifstream input;
input.open("transaction.txt");
while (input>>balance>>check)//while loop
{
//Processing the checks }
}//end while loop
/////////// he also provided with this, to include in the program.
thanks! for the help I really appreciate it
//Please like and comment
//code.cpp
# include <iostream>
# include <iomanip>
# include <fstream>
using namespace std;
int computeCharge(int balance)
{
int charge = 10;
if (balance < 400)
{
charge += 15;
}
return charge;
}
float computCheckFee(int numberOfChecks)
{
if (numberOfChecks < 20)
{
return numberOfChecks * 0.10;
}
else if (numberOfChecks >= 20 && numberOfChecks < 40)
{
return numberOfChecks * 0.08;
}
else if (numberOfChecks >= 40 && numberOfChecks < 60)
{
return numberOfChecks * 0.06;
}
else
{
return numberOfChecks * 0.04;
}
}
float computeFee(int balance, int numberOfChecks)
{
return computCheckFee(numberOfChecks) + computeCharge(balance);
}
void getResult(int balance, int checks)
{
if (checks < 0)
{
cout << " Number of checks must be zero or more" <<endl;
}
else if (balance < 0)
{
cout << " Your account is overdrawn! The bank fee this month is $" << computeFee(balance,checks)<< endl;;
}
else
{
cout << " The bank fee this month is $" << computeFee(balance, checks) << endl;
}
}
int main()
{
ifstream input;
input.open("transaction.txt");
int balance = 0, check = 0;
while (input >> balance >> check)//while loop
{
cout << "Beginning balance : $" << balance << " Number of checks written: " << check;
getResult(balance, check);
}//end while loop
return 0;
}
//output
Get Answers For Free
Most questions answered within 1 hours.