CPSC 120 LAB 3 Back to Lab index page

Lab must be completed and reviewed by Peer Instructor Seth Peery no later than Wed, Sept 12 during lab class.

You are write a nicely documented Ada program that will calculate how much money of one of three types a person has. Your program should contain an enumerated data type defining three values (pennies, dimes, dollars). You should prompt the individual to enter any one of these types, get the type, then prompt the user to enter the number of the coins he/she has of this type. Then calculate the amount of money the person has. Note - the program must not ask the user to input the number of pennies, but rather ask the user what type of money they have, get the type, get the number of coins, then calculate the amount of money of that type. Below is some sample input/output from the program. The program should be named lab3.adb.

Sample 1

Program outputs: Input the type of money (pennies, dimes, dollars) >
User inputs: dollars
Program outputs: How many dollars do you have?
User inputs: 3
Program outputs: You have $3.00.

Sample 2

Program outputs: Input the type of money (pennies, dimes, dollars) >
User inputs: dimes
Program outputs: How many dimes do you have?
User inputs: 2
Program outputs: You have $0.20.

You will use the submit command to submit your programming assignments (not the labs) to me for grading. I want you to test this on a program you have already written before the first assignment is due.