CS 1401 Assignment #4

Date Assigned: Monday, September 24 or Tuesday, September 25, 2007.

Due Date: Monday, October 1, or Tuesday, October 2, 2007, before the beginning of your lab section.

Objective: The main objective of this assignment is to practice using conditional statements.

Programming assignment: Use JOptionPane to design a simple function calculator for computing the values of elementary functions. This function calculator should read simple expressions like exp(-1.5), sin(0.0) or ln(1.0), and generate the result of the corresponding arithmetic operation (or an error message if the user wants to compute the logarithm of 0 or of a negative number). Let us restrict ourselves to functions exp, ln, sin, and cos. For simplicity, feel free to assume that the expressions do not have blank spaces (but please inform the user about this restriction in the input prompt).

Hints: You already know all the tricks that you need to build such a function calculator:

All you have to do is add if-then statements to this set-up.

Homework assignment: on a separate sheet of paper, solve Ex. 10 from p. 218 and Ex. 12 from p. 219.

Deliverables: as instructed by your TA.