Practice: Exceptions

Take out a piece of paper. We’ll be programming on paper.

For the following programming questions, I’d like you to follow the programming algorithm.

1) Read and understand the problem

2) Create the comment stating the problem.

3) Insert the Java boilerplate.

/** Program that ...
 * @author Cam Moore
public class ProgramName {
  /** Does something.
   * @param args the command line arguments.
  public static void main(String[] args) {

4) Write the steps in pseudo code.

5) Refine the pseudo code.

Problem 1

Write a program that uses the Java Scanner class to ask the user for integers. The program should quit looping when the user enters a non integer value. The program should calculate the average of the values input. Use try..catch.

Problem 2

Expand the Jan Ken Po or Rock Paper Scissors game to ask the user if they want to play again. If they say yes the program should play the game again.

Show me your code before you leave