CSc 2311
Programming project #3
DATE ASSIGNED: October 10, 2000

DUE DATE:  October 24, 2000, at 9:30 a.m. (in class)
due date postponed until October 26, at 9:30 a.m.
 

Objectives

1. Practice making classes

2. More practice with streams and files.
 

Introduction

Your assignment is given below. To solve it, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the class example, first, design your program by specifying its behavior, identifying the objects and operations it needs to solve the problem, and then organizing the objects and operations into an algorithm. Then code your design in C++ using stepwise translation. Finally, test your program thoroughly.

Project

1. Solve problem #7 on page 430 of your book.

2. INPUT: Your program should obtain all input from the keyboard. Things to input include loan amount, interest rate, starting month and year.

10/17/00 Notes from questions raised in class:

  1. Input the interest rate as a number. For example, the user should enter "10.5" to mean 10.5%.
  2. The program should run one time.
  3. The program should not run forever (i.e. should not allow a case where the user would never be able to pay off the loan).

3. OUTPUT: Output should be sent to a file. It should include bill month and year, (i.e. "February 2001") followed by the amounts. Include appropriate labels on your output.

4. Name your source file 'hmwk3.cc' and store it in your Panther directory. Create your own library files as well, and give them appropriate names. In this program, you MUST create your own classes, therefore you must have your own library files.

5. Be sure to include the appropriate information as comments in the header of your source file, as specified in homework #1's directions. Also make sure you understand the collaboration policy, and that you follow the standards given in class. (See homework #1, sections 5, 6, and 7).

6. Submit your program to the T.A. Include comments stating how the program should be compiled and run.

TURN IN A HARD COPY OF YOUR SCRIPT FILE IN CLASS, after you have completed the steps below.

When you are finally done with your program, and are ready to submit it, do the following steps.

  1. script hmwk2.log

  2. This command starts recording all the things you type and the responses from the system. "hmwk2.log" is just the name of the file it creates.
  3. cat hmwk2.cc

  4. Shows the contents of the file. You may want to include other relevant commands, such as "ls -l", which gives a file list. Make sure that you repeat this as many times as you need to show all of the files (.h, .doc, .cc) that you used.
  5. g++ yourlibraryfile.cc -c

  6. Compiles "yourlibraryfile" without linking it. Repeat this step for every library file that you have.
  7. g++ hmwk2.cc -o hmwk2 [yourlibraryfile1.o yourlibraryfile2.o ..]

  8. Compiles it.
  9. ./hmwk2

  10. Runs your program. Be sure to try multiple test cases. Three test cases may be enough, but it is up to you to decide how many cases are enough.
  11. ~/../csc6001/submit file1 hmwk2/csc60XX

  12. This calls the "submit" program which is located in the TA's account. It copies the file "file1" to the TA's file space, under the subdirectory "hmwk2/csc60XX". Since everyone will have their own subdirectory under the TA's account, you can submit all of your files without needing to re-name them. Make sure that you submit all of the source files, including the .h, .cc, and .doc files. You do not submit the executable code - we will compile it ourselves. Once you submit a homework, you can re-submit it, but be careful not to do so after the due date and time. Read the submit program's response to make sure it was submitted properly.
  13. exit

  14. This command ends the recording of the things you type/system responses. You can now view "hmwk2.log"