Answered step by step
Verified Expert Solution
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 AND EXERCISE IN JAVA: Exercise : 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 : 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
PASTE CODE HERE
Exercise : 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 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 Write the definition of the main method to build the linked list with random numbers between and To set the contents of each node object add the appropriate mutator methods to set each field as follows:
the decimal field to be the random number divided by
the character field to be letter equivalent of the integer value, and
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 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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started