Question: So i already have the code but i dnt know how to do this . Please Help! Create a method called checkDuplicates which receives any

So i already have the code but i dnt know how to do this . Please Help!

Create a method called checkDuplicates which receives any array of ints, and an integer number. The method will return a true or false, depending on whether the integer number passed to the method already exists in the array of ints (also passed to the method).

Call the checkDuplicates method from both the constructor of the Lotto class and the getUserPicks() method also of the Lotto class. This will prevent you from writing duplicate code in both of these places.

import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class Lottery { int userLotteryPicks[]; int lotteryNumbers[]; int size; public Lottery(int size) { Random rand = new Random(); this.size=size; userLotteryPicks=new int[size]; lotteryNumbers=new int[size]; for(int i=0;i

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!