IUP Computer Science
COSC 110 Spring 2007
Project #3
(UNICEF Cambio Inc.)
(Due 2 March 2007)
UNICEF has long had a program in which
they collect loose change from airline passengers as they are leaving one
country and flying to another. The money goes to UNICEF's many charitable
programs. The organization has decided to follow this program with
the installation of computerized money exchanges in many international
airports. The idea is that an arriving passenger can get money exchanged
at a very low fee and is given an opportunity to contribute the coin part
of the exchange to UNICEF's programs. The machines will be labeled,
UNICEF Cambio Inc.
You have been commissioned to write the
program to control the computerized money exchanges. The machines
each have a big red button labeled "Start", a screen to see program output,
and a keyboard to enter information. When a passenger presses "Start",
your program will run; it needs to do the following things.
-
Greet the passenger, explain what the machine
does, and ask him/her what currency s/he wants to exchange (ask for a single
word currency name).
-
Read the passenger's entry and match it against
one of the allowed currencies. In this trial installation, only six
currencies are allowed: the euro (1 euro = $1.30912), the British
pound (1 pound = $1.95193), the Swiss franc (1 franc = $0.81885), the Russian
rouble (1 rouble = $0.03789), the Japanese yen (1 yen = $0.008475) and
the South Korean won (1 won = $0.001091). The only currency the machine
can dispense is US dollars. The passenger's entry is only one word, one of the highlighted six words above.
-
If the passenger makes a mistake and enters
something that is not one of the six currency names, your program should
explain the problem and ask the passenger to re-enter a currency name.
If the passenger gets the name wrong a second time, the program should
terminate.
-
Once the program has a valid currency name,
it should ask the passenger how much of that currency s/he wants to exchange.
The program should then calculate the equivalent in US dollars and tell
the passenger how much this is. If the dollar amount is greater than
$500, the program must reject the passenger's money (give it back) because
there is a transaction limit of $500. The program should terminate
after telling the passenger what is wrong.
-
If the dollar amount is valid, ask the passenger
if s/he is willing to donate the fraction of a dollar to UNICEF.
If the passenger agrees, deduct the fraction of a dollar from the amount
to be given to the passenger.
-
Regardless of whether the donation is made
to UNICEF, the program must then deduct the exchange fee ($2 per $100 or
part there of being exchanged - original value). The program should
then explain the fee deduction and tell the passenger what s/he will net
in the exchange.
-
Finally, the program should ask the passenger
if s/he wants to make another exchange transaction. If the passenger
indicates that s/he wants another, the program should begin again at the
greeting. If the passenger is finished, the program should end.
All output to the passenger needs to be very
clear because s/he is likely not to have English as a first language.
Here is a sample transaction with minimal
explanation. (I kept it minimal so that you could choose the output
explanations for yourself.) The passenger's entries are in bold.
What currency do you have? yen
How much do you want to exchange? 1200
Your currency is worth $ 10.17
Would you like to give the part less than $1 to UNICEF (y/n)? y
Your fee is $2.00
Your net from this exchange is $ 8.00
Do you want to make another exchange (y/n)?
Approximately three days before this project
is due, I will post on WebCT the combination of transactions that I want
you to test your program with. Hand in a well documented printout
of your program and a printout of the captured output from the transactions
that I specify. Also, copy the .cpp file containing your program
to the handin folder on the P: drive under the COSC 110 folder for your
section. Be sure to name the .cpp file after yourself (I might name
mine
wolfep3.cpp ) so that multiple students do not
try to submit a file named p3.cpp or something similar.