ECE-C 301 Assignment 1: Review of basic Java


Due Date: Sunday Jan. 13th, 2008 11:59 PM

I. Program

Problem Statement

Write a program that can be used as a math tutor for a young student. The program displays a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. Once the user selects a math problem, the program should display two random numbers between 100 and 999. The program should wait for the user to enter the answer. If the answer is correct, a message of congratulations should be printed. If the answer is incorrect, a message should be printed showing the correct answer. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program. If the user selects an item not on the menu, display an error message and display the menu again.

The following is a typical example of the output of the program:


  The Math Tutor
  -------------------
  Chose from the following menu:
  1. Addition
  2. Subtraction
  3. Multiplication
  4. Division
  5. Quit

  Enter your choice:   1

  Addition problem:
    247
  + 129
    ------

  Enter your answer:  376

  Congratulations! Your answer is correct. 

  The Math Tutor
  -------------------
  Chose from the following menu:
  1. Addition
  2. Subtraction
  3. Multiplication
  4. Division
  5. Quit

  Enter your choice:   5

  Good Bye!

Make sure you random numbers generated in the program for the problems given.

Your program (and all subsequent programs) must use good style, including proper variable names, use of indentation and whitespace, and commenting.

Note that for this (and all) programs, you must supply appropriate documentation.

Submission:

Technical Details

Students are to use:

Academic honesty