Question: IN JAVA: Part 1 : Select the Suitor Requirements In the great city of Atlantis, Prince Val had many suitors. He decided on the following
IN JAVA: Part : Select the Suitor Requirements
In the great city of Atlantis, Prince Val had many suitors. He decided on the following algorithm to determine which person he would marry. First, the suitors
would be lined up in order and assigned a number starting with the second would be and so on up to n suitors. Starting with the first, he would count
down the line with each letter of his name Val and then the suitor at "I" would be eliminated from the line. Val would continue counting three more
suitors, and eliminating every third one. When Val reached the end of the line, he would resume counting at the beginning of the line.
For example, if there were seven suitors, the elimination process would be as follows:
Write a program that implements a linked list of nodes to determine the position a suitor should stand if they want to marry the prince, when there are suitors. Your program should
eliminate the suitor by deleting the node corresponding to the suitor for each step of the process.
Each suitor also has a name. You should either add the name, a String, as part of the node object or use a parallel HashMap to perform a name lookup.
Your program should prompt the user for the number of suitors, each suitor's name, and then after your algorithm runs, print the selected suitor and their name.
Be sure to use prompts that make sense to a user who has never run your program before.
Sample Output
Select the Suitor.
Escape the Haunted House.
Sentiment Analysis.
Q Quit.
Your option
Select the Suitor.
Enter the number of Suitors:
Enter name of Suitor #: Doc
Enter name of Suitor #: Grumpy
Enter name of Suitor #: Happy
Enter name of Suitor #: Sleepy
Enter name of Suitor #: Bashful
Enter name of Suitor #: Sneezy
Enter name of Suitor #: Dopey
Suitor # Happy, eliminated.
Suitor # Sneezy, eliminated.
Suitor # Grumpy, eliminated.
Suitor # Dopey, eliminated.
Suitor # Bashful, eliminated.
Suitor # Doc, eliminated.
The correct suitor was # Sleepy.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
