Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. (20 points). Use a Java Main Class file titled PeaBesacdGeme. In the following problem, pegboard is an Acaylist with numbers. Each number in the

image text in transcribed
image text in transcribed
2. (20 points). Use a Java Main Class file titled "PeaBesacdGeme. In the following problem, pegboard is an Acaylist 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 dass variable (static final). Assign N to 10. 1. (4 points) Define a method (static method) ceatembeaboard 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 Acaylist with numbers). 2. (4 points) Define a method (static method) print.peaksandianguliat 1. Here's how the pegboard with 10 holes should look when you print it: (1) 12 (3) (4) (5) (6) (7) (8) (9) (10) Note: You will need to convert the integers into strings before printing. 1. (20 points) Create a Java Main Class file titled "TeamScore.java" (5 points) Write a public method (static method) winner(int points1, int points2) that takes two scores and returns a bealsan. If polntsi is greater than points the method returns true and if pointsi is less than points, the method returns false. Points should not be tied but return false if that ever happens. The method returns false If none of the conditions are true (15 points) in your main method, declare two arrays -the first array is team 1's points and the second array is opponents' points in corresponding games, ie, the first items in the arrays are the scores for each team in the first game and so on. The arrays are the same length. Hard code the values of the arrays, that is, declare the arrays with known values. User input via keyboard or random number generation is not needed. DO NOT use Accaxbists. Using the method winner from above, calculate and print the win/loss record of teami. If all games were won, print out a message saying that teami has a perfect record. Here are some examples: Team1 Points Team1 Points (23,45,65,20) (23,45,65,20) Opponent Points Opponent Points {56,67,20,18) (20,30,20,18) This is what your program should This is what your program should print: print: Team1 Record Team Record Win 2 Win 4 Loss 2 Loss o Team 1 has perfect record! Hint: Call the winner method with scores from the arrays. The winner method will return true/false based on the scores are

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago