Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you are to utilize the Node data structure provided on Blackboard. In this assignmet you are to write a main program that

In this assignment you are to utilize the Node data structure provided on Blackboard. In this assignmet you are to write a main program that implements two methods and a main method as their driver. So, only main and two methods with it. Note: You may not use any of the LinkedList class provided on Blackboard, you may use the methods in it as a guide (you should actually look at them) but you cannot use any of the methods in your solution. Also, you may not modify the Node class in any way, we will assume that you just used it. You should not submit it. You only need to submit only your drive program. Implementation Details: ^^^^^^^^^^^^^^^^^^^^^^^ The following are the implementation details of this assignment, you must adhere to all of the reauirements. Method 1: ^^^^^^^^^ Parameters and return type: Takes as parameters an array of integers, the size of the array of integer (.length is acceptable also) and it should return a Node that is supposed to represent the head of a linked list. Note: You may also choose to make it a void method and pass the head of the linked list as a parameter, if that's easier for you. You have the choice here. Method Logic: The method is supposed to create a linked list represented by its head and populate it with the numbers stored in the array by placing the even numbers in the array first, followed by the odd numbers. You may not change the order of the numbers inside of the array, the order must remain the same as it was read from input. Example: Assume the array is: [0,1, 4, 6, 7, 9, 2, 10, 11, 14, 13, 19, 20] The linked list should be 20->14->10->2->6->4->0->1->7->9->11-13->19 So return back from the function the head of this linked list. Method 2: ^^^^^^^^^ Parmeters and return type: This method shoould take as a parameter the linked list generated in method 1 represented by its head. Method logic: The method should start by reading in one integer from standard input, and based on that integer, it needs to shift the linked list by that many positions. Keep in mind that you need to do the necessary error checking, the shifting can be between 0 and the size of the linked list - 1. Example: Assume the given linked list is: 20->14->10->2->6->4->0->1->7->9->11-13->19 You read in an integer: You input the number 3. The linked list should look like: 2->6->4->0->1->7->9->11-13->19->20->14->10 If you read in a 6: The linked list should look like: 0->1->7->9->11-13->19->20->14->10->2->6->4 If you read in a 13 The method should print an error asking you to enter a number between 0-12. The main program: ^^^^^^^^^^^^^^^^^ 1. Your program should run and ask the user to input the size of an array of integers. Once that's done, the program should read these integers and store them into an array. 2. Once the array has been populated and its size is known, then you need to call method 1 defined above. The result should be a head pointer of a linked list. At this point you declare a cursor method and go through the linked list and print it to the screen. Based on the above example: 20 14 10 2 6 4 0 1 7 9 11 13 19. 3. Call method 2 4. Print the linked list resulting from calling method 2. The rotated linked list. 

PLEASE ANSWER IN JAVA FORMAT

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_2

Step: 3

blur-text-image_3

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

Describe the process of software development life cycle ( SDLC ) .

Answered: 1 week ago