Question: Exercise V - UniqueName.java Write a method find UniqueName that takes in a Scanner object. The method prompts the user to input n, an integer

 Exercise V - UniqueName.java Write a method find UniqueName that takes

Exercise V - UniqueName.java Write a method find UniqueName that takes in a Scanner object. The method prompts the user to input n, an integer denoting the number of names the user is supposed to input. The user is then asked to input n names, and the method should output the most unique name. The uniqueness of a name is the length of the name plus the number of uppercase letters minus the number of characters that occur more than once (case insensitive). Note that a name incurs the same penalty for a given character, no matter how many times it is repeated. If there are two names with the same uniqueness value, output the one that was inputted first. Below you can find an example run: Please enter n: 5 Enter name number 1: Josh Enter name number 2: Emily Enter name number 3: Laure En Enter name number 4: Bobby Enter name number 5: Kenneth Laureen has the highest uniqueness value (9) Explanation: "Josh has a length of 4, a single uppercase letter, and no repeated letters, so his uniqueness is 4 +1 -0=5. "LaUreEn" has a length of 7, 3 uppercase letters, and two 'e's, so her uniqueness is 7+3 - 1 =9. "Bobby" has a length of 5, 1 uppercase letter, and three 'b's. Even though 'b'occurs 3 times, it is only counted once (not twice!) in the penalty. Bobby's uniqueness is therefore 5 +1 1=5. "Kenneth has a length of 7, a single uppercase letter, and two different characters occurring more than once, so his uniqueness is 7 +1 -2 = 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!