Assignment #5 | Heaton Research

Assignment #5

Get the entire book!
Java for the Beginning Programmer

Write a program that will input three things about the user.

  • The user’s name
  • The user’s age
  • The user’s country of citizenship

You must now determine if the user is eligible to vote in your country. If the user is, then notify them, using their name, that they are old enough to vote.

Note: For the United States, check to see if the user enters USA as the country of citizenship, and the age is 18 or greater. If it is, then notify the user that they are old enough to vote. For example, if the user enters USA, a name of “Jeff” and 21, the program would respond.

Hello Jeff, you are eligible to vote in the USA.

If I had entered Jeff, 21 and the United Kingdom, the program would respond:

Hello Jeff, you are not eligible to vote in the United States.  

Of course, if you are using a country other than the USA, your output will follow that countries voting age requirements.

Copyright 2005-2008 by Heaton Research, Inc.