Service Class:LotteryWrite a Lottery class that simulates a lottery. The class should define an array of five integers named lotteryNumbers. The constructor should use the Random class (see the Java API) to generate a random number in the range of 0 to 50 for each element on the array such that each element contains a unique value. The class's match method should accept an array of five integers that represents a person's lottery picks and compares the array elements to the lotteryNumbers array. The method is to return the number of matching digits. For example, the following shows a randomly generated lotteryNumbers array and the user's array with sample numbers stored in each. lotteryNumbers array 17 24 19 21 33 When the user's picks are 24 20 19 17 6 the match method returns 3 since 24, 19, and 17 are found within the lotteryNumbers array. When the user's picks are 33 17 5 2 8 the match method returns 2 since 33 and 17 are found within the lotteryNumbers array. When the user's picks are 11 6 15 24 0 the match method returns 1 since only the number 24 was found within the lotteryNumbers array.In addition, the class should define a toString method which returns a copy of the lotteryNumbers array in an easy to understand String format. Class UML diagram:Lottery - lotteryNumbers : int[] + match(int []) : int+ toString() : String Client Application:Demonstrate the Lottery class in an application that generates an instance of the Lottery class and then allows the end user to check one or more tickets against the generated lottery numbers. The client application should allow the end user to enter five numbers, which are stored in an array; there is no need to verify the input values. The program should display the lottery numbers and the number of digits of the end user's ticket that matched. If all of the digits match, display a message proclaiming the user a grand prize winner. Any number of lottery tickets may be checked. Sample run of the application:Enter your lottery ticket numbers: 24 2019 17 6 The lottery numbers were 17, 24, 19, 21 and 33.You matched 3 numbers!Do you have another ticket to check? (Y or N): YEnter your lottery ticket numbers: 11 615 24 0 The lottery numbers were 17, 24, 19, 21 and 33.You matched 1 numbers!Do you have another ticket to check? (Y or N): YEnter your lottery ticket numbers: 21 1924 33 17 The lottery numbers were 17, 24, 19, 21 and 33.You matched all 5 numbers! You're the winner of the Grand Prize ... An exclusive, all expense paid trip to AACC. This trip includes a walking tour from east campus to west campus, a tour of the CALT building, and a front row parking space for an entire day!!! Congratulations!Do you have another ticket to check? (Y or N): N NOTES:1.You will be developing TWO classes: the Lottery class and the Client class. The Client class contains the main method and should be named Lab1.2.There should be no I/O performed in the Lottery class. All interaction with the end user should be done in the Client class.3.Since the data of the Lottery class is generated by the constructor and can not be changed, accessor and mutator methods for lotteryNumbers are not defined.4.The Lottery class should be documented using Javadocs. Javadocs are not needed for the client class, although your name should be included within comments at the top of the program.5.Adhere to the Style Guide for both classes. 6.The grand prize exists in your imagination only (have fun!)7.Use an initial range of 0 - 9 for the lottery numbers while testing. You'll feel better while debugging! Evaluation:Classes must compile without syntax errors or will not be evaluated. This lab is worth 25 points. Points will be distributed as follows:•Lottery class (18 points) ◦Use of an array of integers◦Use of the Random class◦Definition of methods that support the objectives of the class, including a match and toString method◦Methods produce correct results◦Methods contain no end-user I/O◦Code aheres to the style guide•Client class (6 points) ◦Supports communication with the end-user◦Main method utilizes the Lottery service class to meet the objectives of the application◦Code aheres to the style guide


Are there any questions left?
New questions in the section Computers and Technology
Sign up for the IQClass
Answers from experts with no ads!
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQClass work for you. By using this site, you agree to our cookie policy

Pleased to see you again

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create an account

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign Up
Or sign up with
By signing up, you agree to the Terms of use and Privacy policy.
Looking for an answer to a question you need help with?
you have баллов