Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java Have a project called Lotto and create a class called Lotto. From main call two void methods lottoNumFirstname and lottoStrFirstname. Both methods take
In java
Have a project called Lotto and create a class called Lotto. From main call two void methods lottoNumFirstname and lottoStrFirstname. Both methods take no arguments and return no values. First method should handle Question 1 from below and second method should handle Question 2 from below. ( 10 points ) Question 1 ( 60 points) (Extension of the problem we did in class ) Write a method lottoNumFirstname that takes in a winning lottery of a three-digit number (selected by random number generator ), prompts the user to enter a three-digit number, and determines whether the user wins according to the following rule. Please use a solution that includes numbers only and no strings: - If the user input matches the lottery in exact order, the award is $10,000. - If the digits in the user input is reverse of the digits in the lottery number, the award is $7,000. - For example lottery number 234 and guess number of 432 ( which is in reverse order) - If two continuous digits in the user input match two continuous digits in the lottery number, the award is $3,000. - For example lottery number 234 and guess number of 235 or 534. - But for lottery number 234 guess number of 254 does not work. ( Only if continuous.) - In all other cases print "Sorry play again". - For example lottery number 234 and guess number of 965 or 278 - Result need to be formatted using printf. Method 2: lottoStrFirstname Same problem as above. But redo where your pick number is a string of three digits and the Winning number is a three digit number generated randomly converted into a string. You can reuse the code from the above problem and the problem we did in class but use all string operations instead of integer operations. The user wins according to the following rule: - If the user input matches the lottery in exact order, the award is $10,000. - If the digits in the user input is reverse of the digits in the lottery number, the award is $7,000. - For example lottery number 234 and guess number of 432 ( which is in reverse order) - If two continuous digits in the user input match two continuous digits in the lottery number, the award is $3,000. - For example lottery number 234 and guess number of 235 or 534. - But for lottery number 234 guess number of 254 does not work. ( Only if continuous.) - In all other cases print "Sorry play again". - For example lottery number 234 and guess number of 965 or 278 - Result need to be formatted using printf. As usual submit your whole project in one zip fileStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started