Pi Aloud


Goal:

Use charAt and length methods to access the digits of pi in a String variable.

Steps:

  1. Place the first 20 digits of pi into a String variable.
  2. Print out the first 3 digits of pi. Remember the first digit will be pi.charAt(0).
  3. Use a for loop to print each digit of pi on a new line.
  4. If your computer can play sounds, use the speak method to say each digit of pi using a loop.
  5. [CHALLENGE]
    After printing the first 3 digits of pi, ask the user for the next digit using the getInputFromUser() method
    Compare the users' char to the next digit of pi
    If they are correct, print out "correct". If they are not, print "incorrect"