Lottery Write a program which accepts a series of lottery number inputs from the user and determines how much the user won. PROGRAM DESIGN The program should be able to accept a series of lottery numbers from the user. Lottery numbers should be unique and have no duplicates. Solve this problem using loops and sequences. There should be six (6) unique lottery numbers involved. If the user entered six numbers, these numbers should be compared to a set containing the winning sequence of numbers – the number ordering doesn’t matter in the comparison. For each winning number, 100 pesos is won by the user. The winning set of numbers is { 10, 11, 8, 1, 5, 20 }. INPUT The input consists of a single line input that contains 1.) the name of the user, 2.) six numbers separated by spaces. The name of the user is a string. The six subsequent numbers should be typecasted as integers later in the code. OUTPUT Once the user enters the input, the program should be able to traverse through the numbers and determine how many winning numbers the user has betted on / entered. The user should enter 6 numbers. If the total number of numbers exceeds 6 or is less than 6, the error message “Should be 6 numbers” should be displayed. Otherwise, If the user won at least one winning number the message “User won prizemoney pesos!” – where User is the name of the user, and prizemoney is the total winning numbers times 100. If the user did not win any winning number, the message “User won nothing!” should be displayed instead. Please note that all entered numbers must be unique – with no duplicates. If duplicates were encountered, the error message “No Duplicates” should be displayed. SAMPLE INPUT Ely 1 8 10 27 12 15 Buddy 1 8 27 3 4 9 Raims 9 4 3 12 15 21 Makoy 1 1 8 10 27 15 Nitoy 1 Jugs 1 1 1 1 1 1 1 SAMPLE OUTPUT Ely won 300 pesos! Buddy won 200 pesos! Raims won nothing! No Duplicates Should be 6 numbers Should be 6 numbers
Lottery
Write a program which accepts a series of lottery number inputs from the user and determines how much the user won.
PROGRAM DESIGN
The program should be able to accept a series of lottery numbers from the user. Lottery numbers should be unique and have no duplicates. Solve this problem using loops and sequences. There should be six (6) unique lottery numbers involved. If the user entered six numbers, these numbers should be compared to a set containing the winning sequence of numbers – the number ordering doesn’t matter in the comparison. For each winning number, 100 pesos is won by the user. The winning set of numbers is { 10, 11, 8, 1, 5, 20 }.
INPUT
The input consists of a single line input that contains 1.) the name of the user, 2.) six numbers separated by spaces. The name of the user is a string. The six subsequent numbers should be typecasted as integers later in the code.
OUTPUT
Once the user enters the input, the program should be able to traverse through the numbers and determine how many winning numbers the user has betted on / entered. The user should enter 6 numbers.
If the total number of numbers exceeds 6 or is less than 6, the error message “Should be 6 numbers” should be displayed. Otherwise, If the user won at least one winning number the message “User won prizemoney pesos!” – where User is the name of the user, and prizemoney is the total winning numbers times 100. If the user did not win any winning number, the message “User won nothing!” should be displayed instead. Please note that all entered numbers must be unique – with no duplicates. If duplicates
were encountered, the error message “No Duplicates” should be displayed.
SAMPLE INPUT
Ely 1 8 10 27 12 15
Buddy 1 8 27 3 4 9
Raims 9 4 3 12 15 21
Makoy 1 1 8 10 27 15
Nitoy 1
Jugs 1 1 1 1 1 1 1
SAMPLE OUTPUT
Ely won 300 pesos!
Buddy won 200 pesos!
Raims won nothing!
No Duplicates
Should be 6 numbers
Should be 6 numbers
Trending now
This is a popular solution!
Step by step
Solved in 2 steps