Scanner Objects Exercises

  < Previous  Next >
  1. Do the following in Java code:
    1. Declare a Scanner type object reference
    2. Create a new Scanner object that will read from System.in. Assign the new object to your object reference
    3. Prompt the user to enter their name. Read in their input and store it in a variable.
    4. Prompt the user to enter how many teeth they have in their upper jaw. Read in their input and store it in a variable. Multiple that value by two and display the result.
    5. Prompt the user to enter a joke. Read in their input and echo it back to the user.
  2. Fix the program in SimplePerson.java and SimplePersonDriver.java. Verify that it works by compiling it and executing it.