Assignment #2, Jan. 31, due Tue. Feb. 13 @ 9:45 pm

This assignment will help you put into use array and string constructs of C++. It also delves into function overloading.

test name

header file

you submit

model solution

RATS test

a2_cheque

cheque.h

cheque.h/cpp

cheque.cpp

rats.script

!! **READ THE PROBLEM IN THE TEXTBOOK, NOT ONLY HERE** !!

a2_cheque: Deitel #5.45 (p. 386). Note: American students are forced to use the Canadian spelling in this assignment :)

The problem description in the book says to "assume that nine spaces are available." Our version will allow any number of spaces, and will throw a ChequeBufferOverflow exception if the converted string doesn't fit.

In addition, we will insert a currency symbol string at the start of the buffer. You will want to maintain this in a static char* variable. It should be global within cheque.cpp, but not external scope. It can be reset anytime by calling setChequeSym; otherwise, its default value is "$".

We will create two overloaded versions of chequeAmt, one for dollars and cents, the other for dollars only. Here are some samples of what the output should look like:

We have chequeAmt return the buffer pointer so it can be used like this:

Implementation requirement: You must write the dollars and cents version so that it uses the dollars-only version to convert the dollars part. This avoids duplicating code. See cheque.h for special handling of cents > 99, and all other requirements. You will want to get familiar with the <cstring> library (p. 346-347).