COMP 14-090 Summer I 2000

Assignment 3: A Simple Calculator

Assigned: Tuesday, May 30
Due: Thursday, June 1
Worth: 45 points

Description

Write a program that implements a simple calculator. This calculator should be able to add, subtract, multiply, and divide two numbers. It should also be able to determine the minimum and maximum values given two numbers. Use the SimpleCalculator class you developed in your groups on Tuesday. You must use methods in solving this assignment. Prompt the user for two numbers, then display the results of each operation to the user. The user interface (i.e. what prompts you use and how you format the output) is up to you. The only requirement is that the results of the operations should be rounded to two decimal places.

What to Turn In

Steps to Follow

  1. Follow the instructions in Getting Started with Visual J++ under "Creating a New Project."  Use Assignment3 as your project name.
  2. Follow the instructions under "Adding a New Class."  Name your class SimpleCalculator.
  3. Enter or copy the text of the program outline from the course web page (SimpleCalculator.java under "Sample Code"). To copy from the web, bring up the web page, select Select All from the Edit menu. Then select Copy from the Edit menu. Then go back to the Visual J++ program text window and select Select All from the Edit menu and then select Paste from the Edit menu. That should put the program text into your Visual J++ window.
  4. Fill in your name, program description, input, and output.
  5. Build and run your program to make sure you copied everything correctly. It should just print out
    "==> End of job" and wait for you to hit Enter.
  6. Replace the comments "// Insert your code here" with your code to solve the problem given above.
  7. Save often!

Notes

 


The following output window is just an example (including extra credit). You don't have to use the same formatting. To get black text on a white background, I pasted the captured image into the Paint program and inverted the colors.


Michele Clark
clark@cs.unc.edu

Back to COMP 14