Question

How do you solve this assignment? Create a program that displays the ending balance in a...

How do you solve this assignment?

Create a program that displays the ending balance in a savings account, given the beginning balance, the deposit amounts, and the withdrawal amounts. Use two loops in the program: one to get the deposit amounts, and the other to get the withdrawal amounts. a. Create an IPO chart for the problem, and then desk-check the algorithm two times, using the data shown in Figure 7-52. xid-26481329_1

b. List the input, processing, and output items, as well as the algorithm, in a chart similar to the one shown earlier in Figure 7-42. Then code the algorithm into a program.

c. Desk-check the program using the same data used to desk-check the algorithm.

d. Create a program that display the ending balance with two decimal places. e. Test the program using the same data used to desk-check program.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

double startBalance;

cout<<"Enter the starting balance: ";

cin>>startBalance;

cout<<"Enter the amounts deposited(Enter -1 to quit): ";

double deposit = 0.0;

double endBalance= startBalance;

while(deposit != -1)

{

cin>>deposit;

if(deposit == -1)

break;

endBalance+= deposit;

}

cout<<"Enter the withdrawal amounts (Enter -1 to quit): ";

double encashed = 0.0;

while(encashed != -1)

{

cin>>encashed;

if(encashed== -1)

break;

endBalance -= encashed;

}

cout<<"Ending balance in the account after given transactions is: "<<fixed<<setprecision(2)<<endBalance<<endl;

}


Output:

Add a comment
Know the answer?
Add Answer to:
How do you solve this assignment? Create a program that displays the ending balance in a...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

  • The manager of a local restaurant wants a program that displays the total cost for running...

    The manager of a local restaurant wants a program that displays the total cost for running a party in the restaurant’s banquet room. The restaurant charges a base fee for renting the room. It also charges a fee per guest. Complete an IPO chart for this problem. Desk-check the algorithm twice, using your own sets of data. please use c++ language

  • Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings accou...

    Scenario: John Lee wants a program that allows him to enter the following three pieces of information. His savings account balance at the beginning of the month, the amount of money he deposited during the month, and the amount of money he withdrew during the month. He wants the program to display his balance at the end of the month. Requirements: Complete an IPO chart for this problem, using pseudo code or flowchart in the Processing column. Also complete a...

  • Project 9-2: Account Balance Calculator Create an application that calculates and displays the starting and ending...

    Project 9-2: Account Balance Calculator Create an application that calculates and displays the starting and ending monthly balances for a checking account and a savings account. --->Console Welcome to the Account application Starting Balances Checking: $1,000.00 Savings:  $1,000.00 Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 500 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): s Amount?: 200 Continue? (y/n): n Monthly Payments and Fees Checking fee:              $1.00 Savings...

  • C++ The manager of Keystone Tile wants an application that displays the area of a rectangular...

    C++ The manager of Keystone Tile wants an application that displays the area of a rectangular floor, given its measurements in feet. It should also display the total cost of tiling the floor, given the price per square foot of tile. 1-Create a new project named Intermediate13 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Intermediate13.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program...

  • Please add code for program. movies.txt file. LAB 14-2 Plan and Create In this lab, you...

    Please add code for program. movies.txt file. LAB 14-2 Plan and Create In this lab, you will plan and create an algorithm for Cheryl Liu, the owner of a candy shop named Sweets-4-You. The problem specification is shown in Figure 14-15. Problem specification Cheryl Liu is the owner of a candy shop named Sweets-4-You. She wants a program that displays the following menu: Menu Options 1 Add Records 2 Display Total Sales 3 Exit If Cheryl selects option 1, the...

  • Write in C++ using emacs. Write a program that calculates the ending balance of several savings...

    Write in C++ using emacs. Write a program that calculates the ending balance of several savings accounts. The program reads information about different customers’ accounts from an input file, “accounts.txt”. Each row in the file contains account information for one customer. This includes: the account number, account type (premium, choice, or basic account), starting balance, total amount deposited, and total amount withdrawn. Your program should: - open the file and check for successful open, - then calculate the ending balance...

  • You are to write a Java program using the following instructions to build a bank-ATM server...

    You are to write a Java program using the following instructions to build a bank-ATM server system with sockets. A bank holds accounts that can have deposits, withdrawals, or retrievals of balance. The bank server provides the account for transactions when a client uses and ATM machine. The ATM asks for the type of transaction and the amount (if needed), then creates a socket connection to the bank to send the transaction for processing. The bank performs the transaction on...

  • 6. Checking account reconciliation Aa Aa E How Do You Balance Your Checkbook? Your roommate, Akira,...

    6. Checking account reconciliation Aa Aa E How Do You Balance Your Checkbook? Your roommate, Akira, is embarrassed. She has never before had a checking account, but she finally opened one last month. She's standing in the doorway of the kitchen with her check register in one hand and her recently arrived bank statement in the other. Admitting that she doesn't know what to do next, she's asked for your help in learning how to reconcile, or balance, her checkbook....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT