Using Classes: Money, Strings, and Streams
Reading: Part B of the Syllabus. See also, Sections 2.4 and 3.7 of the Friedman/Koffman text (2nd Edition).
Programming: Four small programs are required. They are to be done individually. Feel free to discuss your ideas with others, but write the programs on your own.
PART I -- (Individual -- no groups)
A. Two short programs:
B. Given the results illustrated in Part A., perhaps we need a better way to handle money in C++. It appears as though the use of floating point values may not do the job -- perhaps we will lose some pennies along the way? We need to come up with a new scheme for representing and manipulating money -- perhaps as dollars and cents?
Devise such a new scheme -- one that I could program once you tell me what to do. In particular, tell me the following:
Turn In: For Part A., just turn in the two programs (no documentation is needed). For Part B., turn in an English descriptions (with pseudo-code algorithms as needed for 2. and 3.) of what I am supposed to do. For Part B, among other things, I n eed to know exactly how to add two type money data elements and how to multiply a money type element times a float type element.
Due Date: No later than Tuesday, February 3 (in class).
PART II (Individuals, no groups)
Read carefully Chapter 5 in Savitch's text [and look over Appendix C (also on Stream I/O) in Headington and Riley].
Do Programming Project Number 8 (p. 276 in Savitch's book)
Turn In: Working versions of the programs for Project Number 8 (no documentation is needed). Test your programs on data samples of around a dozen records. You should construct your own data file and you may assume there are no errors in your fil e.
Due Dates: Friday, February 6 at noon (handed in to the lab instructor).