Please create a java program that allows the user to create a fake lottery game and see how many tickets they need to bu

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Please create a java program that allows the user to create a fake lottery game and see how many tickets they need to bu

Post by answerhappygod »

Please create a java program that allows the user to create afake lottery game and see how many tickets they need to buy to geta jackpot.
Ask the user to enter the total # of numbers that will be usedin the ticket, ensure the value is between 3 and 10
Ask the user to enter the max value for the numbers in theticket, ensure it is less than 100
Create a class for LottoTicket that has an arrayList of integersfor the numbers.
Add a constructor that accepts values for numberOfValues andmaxValue
Add the numberOfValues of random numbers 1 to maxValue (including max value ) to the arraylist of integers
add a method isWinner that accepts an instance of LottoTicket (not the values themselves, but another instance of the LottoTicketclass ), and return true if all of the values in the ticket matchall of the numbers in the array list of values ( remember, don'tjust compare the two arrays with == to see if they match, thatwon't work ).
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply