Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming write a static method name dengestName that reads names typed by the user and prints the longest name the name that contains them ost

image text in transcribed

Programming write a static method name dengestName that reads names typed by the user and prints the longest name the name that contains them ost characters) in the format shown below. Your method should accept a console Scanner and an integer nas parameters and should th en prompt for n names. The longest name should be printed with its first letter capitalized and all subsequent lettere in lowercase, regardless of the capi talization 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 earliest. Also print a message saying tha t 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 th e left log below; but don't print a message unless the tie is between the longest names. You may assume that n is at least 1, that each name is at least 1 character long, and that the user will type single-word names cons isting of only letters. The following table shows two sample calls and their output. Scanner console = new Scanner(System.in) longestName(console, 7); Scanner console = new Scanner(System.i Call longest Name (console, 5); Output name 1? roy name #2? DANE name #3? Erik name #47 stefaNiE name #5? Laura Stefanie's name is longest name #1? Trent name #27 rita name #37 JORDAN name #4? craig name #5? leslie name #6? YUKI name #7? TaNnEr Jordan's name is longest (There was a tie!)

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

How are the present value and future value related?

Answered: 1 week ago

Question

2. How do they influence my actions?

Answered: 1 week ago