Computer Science Department |
Objectives:
|
|
Background:
|
This program will read in a 3 character expression which happens to be in what is called postfix notation (i.e. the operator follows the operands) and displays it in what is called infix notation (i.e. the operator is placed in between the two operands). Example of infix: 1+a Example of postfix: 1a+ The operands in this program are single digits in base 16 notation (i.e. the acceptable digits are: 0123456789abcdef) The final output of the program is the original expression in infix notation with the result shown in to base 10. Note: one of the objectives is to have you debug code; so here you have a program that does not work properly. There are compiler errors as well as logic errors in the code. Your job today is to correct those errors and to properly document this code so that those that follow behind you can more easily make changes. This program will only allow the single digit operands shown above (0 - f)
and the operators + and -. The code should print an appropriate error message
and abort (with a |
New Terms: |
Test case - a single instance of data to test a program. A test case includes the input and the expected output or program behavior. |
Materials:
|
|
Acknowledgment |
From an original lab by Arch Harris |
Your lab will be evaluated based
on:
Updated 08/22/08 (esa)