Docsity

Problems on Introduction to Programming - Assignment 1 | CS 140, Assignments of Computer Science

Toggle sidebar
bg1
Problem description:
John Doe wants a program in which he can 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.
Your tasks:
1. Complete an IPO chart for this problem, using pseudo code in the Processing
column;
2. Use paper and pencil to check your algorithm, using the following information:
Savings account at the beginning of the month: 2000
Money deposited during the month: 775
Money withdrawn during the month: 1200
Use a different set of numbers of your own for a second desk-check
3. Create a project named "bankProject" on your hard drive using the instructions in
the handout;
4. Add a C++ source file (call it yourName.cpp) to the project. Copy the code given
at the end of this file to your source file. This program calculates and displays the
ending balance amount;
5. Study the existing code. Notice that the statements to prompt the user to enter
beginning balance, deposit, and withdrawal are missing from the program. The
statements that allow the user to enter that data are also missing. Your job is to
enter the missing statements in the appropriate areas of the program.
6. Save and then build the program. If necessary, correct any errors and save and
build the program again. Execute the program. Test the program by using the
same sets of data you used previously;
7. When the program is working properly, save the source file and close the
workspace.
8. Copy the completed yourName.cpp file from the hard drive to A.
Items to hand in:
Printed copies of IPO chart, the completed yourName.cpp file.
pf2

Partial preview of the text

Download Problems on Introduction to Programming - Assignment 1 | CS 140 and more Assignments Computer Science in PDF only on Docsity!

Problem description: John Doe wants a program in which he can 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. Your tasks:

  1. Complete an IPO chart for this problem, using pseudo code in the Processing column;
  2. Use paper and pencil to check your algorithm, using the following information: Savings account at the beginning of the month: 2000 Money deposited during the month: 775 Money withdrawn during the month: 1200 Use a different set of numbers of your own for a second desk-check
  3. Create a project named "bankProject" on your hard drive using the instructions in the handout;
  4. Add a C++ source file (call it yourName.cpp) to the project. Copy the code given at the end of this file to your source file. This program calculates and displays the ending balance amount;
  5. Study the existing code. Notice that the statements to prompt the user to enter beginning balance, deposit, and withdrawal are missing from the program. The statements that allow the user to enter that data are also missing. Your job is to enter the missing statements in the appropriate areas of the program.
  6. Save and then build the program. If necessary, correct any errors and save and build the program again. Execute the program. Test the program by using the same sets of data you used previously;
  7. When the program is working properly, save the source file and close the workspace.
  8. Copy the completed yourName.cpp file from the hard drive to A. Items to hand in: Printed copies of IPO chart, the completed yourName.cpp file.

// account.cpp; written by ..... - this program calculates and displays the ending balance #include using namespace std; int main() { //declare variables float begBal = 0.0; float deposits = 0.0; float withdrawals = 0.0; float endBal = 0.0; //enter input items //calculate ending balance //display ending balance return 0; } //end of main function