University of Nevada Las Vegas
Howard R. Hughes College of
Engineering
School of Computer Science
My Home Page
UNLV CS Spring 2007 Assignment 3

CS 302 Assignment 3
Due date: Tuesday, February 6, 2007, midnight.
All programming assignments must be
submitted electronically.
Submit them to the graduate assistant,
James Oravec,
on or before the due date.
All written assignments must be handwritten
(not typed or printed from a
computer file) in your own handwriting, on 8.5 by 11 inch paper, or on A4
paper. Write your name on each sheet, and do not fold the pages or crimp the
corners. (You may use a paper clip or a staple.)
Work Exercise 3.22 on page 110 of your textbook.
Your program should read in a postfix expression written on one line.
The expression may consist of numerals of up to 2 digits (no decimal
points) and the operators '+', '-', '*' and '/'. The tokens are separated
by spaces.
Examples:
-
4 3 + 12 *
The answer is 84
-
4 3 5 - - 5 /
The answer is 1, because you are to use integer division, which truncates.
-
8 4 2 / /
-
8 4 / 2 /
These last two have different answers.
