University of Calgary

calculator

Calculator
source: Tino Duong, 2003 

Description:

There are many different types of calculators that are come with different Operating Systems. Many of these are fancy graphical calculators, xcalc in the Red Hat Linux environment for example.

You job is to write a simple text based calculator that take user keyboard input. The user should be prompted to enter the desired expression. The program will then parse the information into operands, and operators and then calculate the expression.

Requirements:

    Have the output look similar to this:

    -----------------------------------------------
    # Welcome to Tino's Calculator Program         #
    -----------------------------------------------
    #                                              #
    # This program will calculate a given          #
    # expression.                                  #
    #                                              #
    #  Enter the expression when prompted then     #
    #  hit the <ENTER> key to calculate.           #
    #                                              #
    # Legal Operators : (,),^,/,*,+,-              #
    # Legal Operands : Any number from the Real    #
    #                  number system. (This        #
    #                   includes negative numbers  #
    #                   and decimal numbers)       #
    #                                              #
    #----------------------------------------------#

    Please select a choice from the menu above :


    Please enter the expression 
    (8+2) * -0.23 +5
    The solution is 2.7

Additional/Optional Requirements:

Concepts:



Updated: August 31, 2005 02:22 PM