Question: Question 8 1 5 p t s Programming Write a static method named longestName that reads names typed by the user and prints the longes
Question
Programming
Write a static method named longestName that reads names typed by the user and prints the longes name the name that contains the most characters in the format shown below. Your method shou Id accept a console Scanner and an integer as parameters and should then prompt for names. The longest name should be printed with its first letter capitalized and all subsequent letters in lowercase, regardless of the capitalization the user used when typing in the name.
If there is a tie for longest between two or more names, use the tied name that was typed earlie st Also print a message saying that there was a tie, as in the right log below. It's possible that some shorter names will tie in length, such as DANE and Erik in the left log below; but do print a message unless the tie is between the longest names.
You may assume that is at least that each name is at least character long, and that the ser will type singleword names consisting of only letters. The following table shows two sampl e calls and their output.
tableCalltableScanner console new Scanne System.in;longestName console,
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
