Question: i need code for this peg game, extra credit included (details are in second photo) 2. (20 points) Use a Java Main Class file titled

2. (20 points) Use a Java Main Class file titled "PegBoard Gome" In the following problem, pegboard is an AtrayList with numbers. Each number in the list represents a hole that can be pegged. The list can have N number of items where N is a class variable (static final). Assign N to 10 1. (4 points) Define a method (static method) create pegboard that takes no arguments and creates the pegboard with N number of holes (use a for loop and the add method of arrays). This method returns the pegboard created (an arrayList with numbers). 2. (4 points) Define a method (static method) grint.eegboard'AuraylistsInteger pegboard) that takes a pegboard and prints it i.e. prints the items in the Attaulist). This method does not have a return value and hence Is a void method. Your method should work for any values of N > 1. Here's how the pegboard with 10 holes should look when you print it: (1) 2(3) (4) (5) (6) (7) (8) (9) (10) Note: You will need to convert the integers into strings before printing 3. (6 points) Dolne a method (static method) ace hold Axeylist integer pegboard) that takes a pegboard. Based on user choice the method will peg one of the holes with a if it is not already pegged. For example, if user chooses to peg the hole 2, the pegboard with 10 holes should look like: (1) (OLD) (4) (5) (6) (7) (8) (9) (10) If it is already pegged, print an appropriate message. 4. (6 points) in the main method, add the following code to test your methods and add comments to explain each line of the code. Be specific and provide detailed explanation. For example, first line the method createBegboardl) that takes no arguments is called, which creates an array list with N numbers and returns that list. The returned list is assigned to the ArrayList variable pegboard BERL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
