COSC 071: Computer Science I

Project 1
Spring 2011

Due Fri, Feb 11 @ 5 PM
6 points

Hoya Saxa Banking Corporation (HSBC) needs you to help them with their electronic banking system. They need a program that will let customers enter information for electronic checks or payments. An odd aspect of their application is that customers always submit transactions in batches of three. HSBC need a program that prompts for the fields of the three payments, writes this information to the console, and then writes the total of the payments to the console.

A payment or check has or consists of a number, a date, a payee, and an amount. You can assume that payees will not contain spaces. You can also assume that all entered values will be correct. We'll relax these assumptions in later projects.

The program should prompt the user to enter the information for each of the three payments. After the user enters the information for these payments, the program should print all of the information to the console. It should also print the total of the three payments. A transcript of a sample run appears below with the user's input typeset in bold:

seva% g++ p1.cc
seva% a.out
Enter information for Payment 1:
Number: 345
Date: 01/01/2011
Payee: Tombs
Amount: 34.56
Enter information for Payment 2:
Number: 346
Date: 01/02/2011
Payee: Wisemillers
Amount: 7.95
Enter information for Payment 3:
Number: 347
Date: 01/02/2011
Payee: Safeway
Amount: 45.67

Payment 1:
  Number: 345
  Date: 01/01/2011
  Payee: Tombs
  Amount: $34.56

Payment 2:
  Number: 346
  Date: 01/02/2011
  Payee: Wisemillers
  Amount: $7.95

Payment 3:
  Number: 347
  Date: 01/02/2011
  Payee: Safeway
  Amount: $45.67

Total: $88.18
seva%

A critical approach to developing software systems is decomposing a programming task into smaller, manageable pieces. When you write or enter your C++ program, do not enter it all at once, as you might a term paper. We will talk more about stepwise refinement and incremental development in class, but you should always enter or write the program in manageable pieces. Start with an empty main function (e.g., a copy of template.cc). Declare an object, use it in an input statement, output its value, then compile and run the program. If everything works as expected, declare another object, use it in an input statement, print its value, then compile and run the program. Continue in this fashion until you've entered your program. Critically, you should always have a program that compiles and executes. It may not do everything, but it will always compile and execute.

This approach minimizes errors and helps manage the complexity of software development. If you start each step with a working program and you add a few lines of code, if you make a mistake, then it mostly likely involves the last few lines you typed. On the other hand, if you start by entering your 300-line program all at once and compiling, you will be overwhelmed by the number of compiler errors. Even seasoned programmers don't do this.

Instructions for Submission

At the top of the file containing your source code (i.e., the file containing the C++ instructions), place the following header comment, with the appropriate modifications:
/**
 * COSC-071 Project 1
 * Name: <your name>
 * E-mail: <e-mail address>
 * Instructor: Maloof
 * Spring 2011
 *
 * In accordance with the class policies and Georgetown's Honor Code,
 * I certify that, with the exceptions of the lecture notes and those
 * items noted below, I have neither given nor received any assistance
 * on this project.
 *
 * Description: <Describe your program>
 */

When you are ready to submit your program for grading, use the submit program, just like you did for HW2. Both submit.jar and the file containing your program should be in the same directory. You can confirm this by listing the files in your home directory:

seva% ls
p1.cc    submit.jar
You may see other files from previous assignments in your home directory, but p1.cc and submit.jar should be among them.

This assignment's label is p1. Assuming the file you want to submit is p1.cc, then to submit you enter the command

seva% java -jar submit.jar -a p1 -f p1.cc
Make sure you submit the file containing your program's source, not its executable code; that is, do not submit a.out.

Once you've submitted your project, it is a good idea to keep a copy on seva, which preserves the modification date and time and ensures that you will have a backup copy of your project. If we lose your project or submit breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due.

The TAs who will be grading your projects this semester are listed on the main page. You must submit your project before 5 PM on the due date.