Monday, October 8, 2012

Java Exercise #16: Lottery

This program is to develop a simple lottery program.

Exercise: Write a program that randomly generates a two-digit lottery integer and asks user to guess it. The winner is determined based on following:

  1. If the user input matches exactly with lottery, the award is $10,000.
  2. If the user input matches in digits, the award is $5000.
  3. If one input digits matches with lottery, the award is $2500.

Enter your lottery pick: 34
Lottery is : 17
Sorry. No match.
Enter your lottery pick: 82
Lottery is : 12
Match one digit! You won $2500

Download Code: Lottery

No comments:

Post a Comment