Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE ANSWER ONLY EXERCISE 4 AND EXERCISE 5 IN JAVA: Exercise 1 : Define an NodeType as follows: contains four members variables, an integer, a

PLEASE ANSWER ONLY EXERCISE 4 AND EXERCISE 5 IN JAVA: Exercise 1: Define an NodeType as follows:
contains four members variables, an integer, a float, a char, and a bool.
NodeType object called link.
Include methods to instantiate the NodeType object, insert a node to the linked list, and print the content of a node to the console. Exercise 2: Write the definition for a driver method called findKthNode that takes as its parameters the linked list (NodeType pointer) and an integer value. The method should find the reference to the kth node and return the integer position of the node to the calling function. If the kth node does not exist, the method should return a -1.
/*PASTE CODE HERE*/
Exercise 3: Write the definition for a driver method called deleteKthNode that takes as its parameters the linked list reference (NodeType pointer reference) and an integer value. The method should find and delete the kth node in the list. If the kth node does not exist, the method should print a message saying "The kth node does not exist in this list".
/*PASTE CODE HERE*/
Exercise 4. Write the definition of a driver method called size that takes as its parameter a linked list (NodeType pointer). The method should count how many nodes are in the list and return that value to the calling function.
/*PASTE CODE HERE*/
Exercise 5. Write the definition of the main method to build the linked list with 10 random numbers between 65 and 97. To set the contents of each node object add the appropriate mutator methods to set each field as follows:
1. the decimal field to be the random number divided by 2,
2. the character field to be letter equivalent of the integer value, and
3. set the boolean member to true if the integer value is even and false otherwise.
Declare an integer variable called length and call the size method defined in exercise 4. Print the contents of the linked list and the length value to the console. The main method should prompt the user to enter a number corresponding to the kth node in the linked list. Write statements to call the findKthNode method defined in exercise 2. Display the of the found variable to the console.
/*PASTE CODE AND OUTPUT SCREENSHOT HERE*/

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions