Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please help me with this project ? Name of Project: YourUsername_P1. My project name would be mutsuday_P1. Use this format as it helps

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Could you please help me with this project ?

Name of Project: YourUsername_P1. My project name would be "mutsuday_P1". Use this format as it helps during grading. See video posted on Canvas (Media Gallery) that shows how to create a project, add multiple java programs to the same project, how to execute the programs and how to zip the project. All projects must be submitted in Netbeans format, no matter what IDE you use to develop your program. Upload your Java Project as a .zip file to Canvas under Assignments Project 1. Name your file as YourUsername_P1.zip e.g. If I were to upload it, it would be mutsuday_P1.zip. The goal of this project is to learn to write programs using methods, Arrays and ArrayLists. Problem 1 (20 points) Create a Java Main Class file titled "Compare" (15 points) Write a public method (static method) arrayEqual(int[] a,int[] b) that takes two arrays and returns a boolean. If the two arrays have the same numbers in the same Problem 1 ( 20 points) Create a Java Main Class file titled "Compare" (15 points) Write a public method (static method) arrayEqual(int [] a, int [] b) that takes two arrays and returns a boolean. If the two arrays have the same numbers in the same order, then the method returns true. Otherwise, it returns false. (5 points) In your main method, get user input for filling the two arrays. Then call the arrayEqual method. When the method returns true, print a message saying that the two arrays are equal. When the method returns false, print a message saying that the two arrays are not equal. Problem 2 (20 points) (20 points) Use a Java Main Class file titled "BoardGame" In the following problem, a board is an Arraylist with numbers. Each number in the list represents an empty position that can be filled. 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_board() that takes no arguments and creates the board with N number of positions (use a for loop and the add method of arrayLists). This method returns the board created (an ArrayList with 2. (4 points) Define a method (static method) print_board(ArrayList board) that takes the board and prints it (that is, prints the items in the ArrayList). 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 board with 10 positions should look when you print it: 12345678910 Note: You will need to convert the integers into strings before printing. Remember index starts from 0. 3. (6 points) Define a method (static method) pick_position_to_fill(ArrayList board) that takes a board. Ask the user for a number input between 1 and 10 . Based on user choice the method will fill one of the board positions with a 0 if it is not already filled. For example, if user chooses position 2 (which is index 1 in the arrayList), the board should look like: 3. (6 points) Define a method (static method) pick_position_to_fill(ArrayList board) that takes a board. Ask the user for a number input between 1 and 10 . Based on user choice the method will fill one of the board positions with a 0 if it is not already filled. For example, if user chooses position 2 (which is index 1 in the arrayList), the board should look like: 10345678910 If it is already filled with a 0 , 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 create -board() 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 board. ArrayList> board = create board() print board(board); for (int i=0;i

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago