Programming Drill #4

Due: Monday, September 17
Goal:  Input a String and use some String methods

You can use NetBeans or Textpad or any other IDE you wish.

Write a program that allows the user to enter the number of people in their household, their first name, and then outputs the expected PFD amount that will be received in 2012 using the KTUU estimate of $898 per person.  Here is a sample of what the program might look like where what the user types is in bold:

  How many people are in your household?
  2
  What is your name?
  robin debanque
  robin debanque, your household is expected to get a total of $1796 from the PFD this year.        

Use the nextInt() method to read the number of people into an int variable called numPeople.  Then use the nextLine() method to read the name into a String variable called name.  Since this is coming after the nextInt() you will have to add an extra nextLine() to avoid the pitfall discussed in class (try it without the extra nextLine() to see what happens if it is missing).  Finally, output the name and 898  multiplied by numPeople.

After you have gotten the program to work, modify it so the program will capitalize the entire name.  For example, using the same input as shown above the program would output:

  How many people are in your household?
  2
  What is your name?
  robin debanque
  ROBIN DEBANQUE, your household is expected to get a total of $1796 from the PFD this year.        

To capitalize the name, use the toUpperCase() method.

Show your program to your instructor or email it to kenrick@uaa.alaska.edu by the end of the day for full credit.