1. Log in to UH UNIX (Secure Shell in Windows)
or (Putty)
and create a Java application that fulfills the following requirements:
- Write a program that will look like the following:
Simple Java Calculator
Please choose what you want to do by entering the corresponding number:
1. Add two numbers (a + b)
2. Subtract two numbers (a - b)
3. Multiply two numbers (a * b)
4. Divide two numbers (a / b)
5. Exit this program
- You must use switch statements to implement the menu choice selection
- If the user selects 1 then the program will request 2 numbers, add them
and print the result. The program should end after this.
- If the user selects 2 then the program will request 2 numbers, subtract
them and print the result. The program should end after this.
- If the user selects 3 then the program will request 2 numbers, multiply
them and print the result. The program should end after this.
- If the user selects 4 then the program will request 2 numbers, divide
the first by the second one, and print the result. If the second number is
zero you will not execute the operation and instead you will display an
error message (it's impossible to divide by zero). The program should end
after this.
- Each one of the operations should be performed in a
separate method,
therefore the program should have the main method and another 4 methods.
- The four methods will be void since they will perform the task and print
the result all together.
- If the user selects 5, then the program will end.
- Have user friendly error messages. "Think" about your error messages so
that they tailor to the error.
- You need to write comments using
the
JAVA coding standard - failure to do so will result
in up to a 30% deduction from your score.
2. Open Pine (Getting
Started with Pine, PDF) and send an email with the file attached to ics111-lab@hawaii.edu account.
- Your e-mail should have the following subject: lab X / lastname (substitute
the lab number for 'X', and lastname should be substituted for your lastname) Not following this standard will result in a deduction
of points.
- SEND YOUR .JAVA FILES WITH (ATTACHED) TO THE EMAIL.
3. Check the webpage to make sure that the e-mail arrived at
http://www2.hawaii.edu/~tp_200/bmf/ics111-lab.html
For
grading policies on your lab, click here...