Question: JAVA Lab -Lottery Calculator IMPORTANT: This lab is best implemented using a loop structure. If you implement this without a loop, you would need to

JAVA

Lab -Lottery Calculator

IMPORTANT: This lab is best implemented using a loop structure. If you implement this without a loop, you would need to run your program once for each test item.

Create a java program that will test for winning numbers on a lottery game. Each lottery ticket will have 5 integer numbers. Valid numbers must be integer numbers between 1 and 55 Assume that the winning Lottery ticket is 1 9 15 33 40

Your program is to input numbers at the console (use of Scanner is recommended) The program will continue to check tickets and report winnings until the user enters some stop code to exit.

Sample of a possible program output:

Enter the numbers on your ticket // Program prompt 2 18 20 32 51 // User inputs numbers Sorry, you have no matches // Result

Enter the numbers on your ticket // Program Continues 1 9 18 33 40 // User inputs numbers You matched 5 numbers! You win $5000 // Results

Enter the numbers on your ticket 2 4 6 8 85 // Valid Check invalid number (85)

Select how many tickets your are scanning or enter some sort of response to indicate you are finished with the program (Your choice on this) // Check for more tickets // Input signals to end the program Exit with "Thanks for Using the Lottery Calculator" //

TEST DATA Use the following ticket values to test your program Winning Lottery Numbers 1 9 15 33 40 1 10 16 35 30 3 9 15 47 49 1 9 18 33 40 2 4 6 8 85 3 9 15 47 49 1 10 16 35 30

Your program is to determine how many matches each tickets have with the winning number. You will print results matches and prize won after entering each ticket won.

Matching results: If no matches of the winning drawing. No prize If the ticket matches 5 out of 5 matches a prize of $5000 is earned If 2-3 matches the ticket wins $10. If the ticket matches one number ticket wins $1. If there are no number matches, indicate "No Matches". Use the winning Drawing of 1 9 15 33 40 for this Lab

Scanner setup tip: import java.util.*; Scanner input = new Scanner(System.in); int number; number = scan.nextInt();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!