Question

hello!! So this is my CIS assignment, my professor is very hard to understand and he...

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

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In c++ format please Bank Charges A bank charges $10 per month plus the following check...
In c++ format please Bank Charges A bank charges $10 per month plus the following check fees for a commercial checking account: $.10 each for fewer than 20 checks $.08 each for 20–39 checks $.06 each for 40–59 checks $.04 each for 60 or more checks The bank also charges an extra $15 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...
Randy, a student, has $500 to deposit in a new checking account, but Randy knows he...
Randy, a student, has $500 to deposit in a new checking account, but Randy knows he will not be able to maintain a minimum balance. He will not use an ATM card, but will write a large number of checks. Randy is trying to choose between the unlimited check writing offered by South Trust and the low per-check fee offered by Sun Coast. How many checks would Randy have to write each month for the account at South Trust to...
home / study / business / accounting / accounting questions and answers / use the following...
home / study / business / accounting / accounting questions and answers / use the following to answer questions 21 - 25 tj company's cash ledger reports the following ... Question: Use the following to answer questions 21 - 25 TJ Company's cash ledger reports the following for ... Use the following to answer questions 21 - 25 TJ Company's cash ledger reports the following for the month ending October 31, 20XE. Deposits Checks Date Amount No. Date Amount 3-Oct...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing associated with the assignment it is failing one part of testing.   Below is the test that fails: Failed test 4: differences in output arguments: -c input data: a b c -c expected stdout: b observed stdout: a b expected stderr: observed stderr: ./test: invalid option -- 'c' Unsure where I have gone wrong. MUST BE WRITTEN IN C++ Task Level 1: Basic operation Complete...
CSC 322 Systems Programming Fall 2019 Lab Assignment L1: Cipher-machine Due: Monday, September 23 1 Goal...
CSC 322 Systems Programming Fall 2019 Lab Assignment L1: Cipher-machine Due: Monday, September 23 1 Goal In the first lab, we will develop a system program (called cipher-machine) which can encrypt or decrypt a code using C language. It must be an errorless program, in which user repeatedly executes pre-defined commands and quits when he or she wants to exit. For C beginners, this project will be a good initiator to learn a new programming language. Students who already know...
You can complete this assignment individually or as a group of two people. In this assignment...
You can complete this assignment individually or as a group of two people. In this assignment you will create a ​​Sorted Singly-Linked List​ that performs basic list operations using C++. This linked list should not allow duplicate elements. Elements of the list should be of type ‘ItemType’. ‘ItemType’ class should have a private integer variable with the name ‘value’. Elements in the linked list should be sorted in the ascending order according to this ‘value’ variable. You should create a...
Suppose that the file inData.txt contains the following data: 3   4 5 15.6 “Mark” “Taylor” 28...
Suppose that the file inData.txt contains the following data: 3   4 5 15.6 “Mark” “Taylor” 28 18500 3.5 B The numbers in the first line represent the Side A, Side B and Side C of a Triangle. The number in the second line represents the radius of a circle (Assume that p = 3.1416). The third line contains the first name, last name, and the age of a person. The first number in the fourth line is the savings account...
Case 13 ✍ It Was Really So Simple Background Information Brenda Galway leaned back in her...
Case 13 ✍ It Was Really So Simple Background Information Brenda Galway leaned back in her chair, sighed heavily, and slowly rubbed her eyes in big circular motions. “I don’t need all this aggravation,” she thought to herself. She had just finished reviewing the report she had requested from her new employee, Bill Stanley. The entire report was incorrect and would have to be redone. Brenda supervised Unit B of the Audit Department. The Unit B team had earned the...
I completed everything except for the last part. I know my answers are right because i...
I completed everything except for the last part. I know my answers are right because i double checked but i just dont know how to answer the last section. Problem 3-1 Schedule C (LO 3.1) Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is located at 678 Third Street, Riverside, CA 92860. Scott’s income statement for the year...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the codes below. Requirement: Goals for This Project:  Using class to model Abstract Data Type  OOP-Data Encapsulation You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should...