Practice: Subroutines

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

Write Java code for the following problems.

Problem 1

Write a public static subroutine getString that asks the user to enter a hexidecimal String. Then uses getHexValue to convert that String to an int. The subroutine should return the int value.

Problem 2

Write a public static subroutine that calls public static int playGame(int num) and calculates the average score. The subroutine should take two int parameters num and numberOfGames. numberOfGames is the number of time to call playGame.

Problem 3

What is the value represented by the following numbers?

Show me your code before you leave