Assignment #6 - 94B
Assignment #6 - 94B
Due 18 November 1994
E-Mail to HCA6 <<== Mail sent anywhere else will be IGNORED
Remember your C program and output MUST be sent from your HC__ code
T.A. Lucie Bernier Room 322
Keep in mind the main goals of this assignment when working at it:
1 - Help you develop a structured way of programming
2 - Teach you how to re-use existing code: i.e. make clear code
for later re-use
- modify existing code to have it suit your current problem
- always well document your program so you and others
can understand and re-use easily.
You will be designing a calculator with few "special" operations.
These will be :
+ : addition of real numbers
- : subtraction of real numbers
* : multiplication of real numbers
/ : division of real numbers
sin : sine of an angle - real number entered in degree
exp : exponentiation of 2 numbers - first real number is the base,
second real is the exponent
sv : verification of an individual's SIN number !! (int)
re-use code from assignment 5 !
outputs if SIN was valid or not.
The first goal is to have a structured program,
which means you should have all specific operations
together in specific procedures , i.e. your main program
will mostly only be call statements to procedures
(for example, you should try to keep it to a maximum of 20 lines,
more or less)
So you could have a procedure to input operation desired,
another one to check the validity of the operation input, etc...
You should first have an introduction displayed to the user,
explaining how your "super calculator" is working,
what operation are available, how to input the data, etc.
This calculator will be interactive so you also need to tell
the user what to enter to exit the program.
After reading the operation desired in, check validity of
what was asked, and read operands for the operation,
checking again validity and have the result displayed.
Below is a list of test data to run your program on, make sure you
also show how your validation routines work in your running.
Of course you can add a few more testing of your program
if you added more features to it than what is asked.
Be creative! Remember the goals above!
+ 345.3 -846
- -20 1826.8
* 10.34 0.5
/ -21.0 -3
/ 789.94 0.0
exp 453 0.0
exp 2.0 5.0