CHALLANGE: Capitalize and display names (string). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

CHALLANGE: Capitalize and display names (string).

Write a program that receive string input (Names) and the displays each name in a new. The separator is comma followed by space Example, the list (john, fatima, bill, christy. the ouptu should look like this: 1. Name: John 2. Name: Fatima 3. Name: Bill 4. Name: Christy

16th Jan 2018, 2:51 PM
StoneCoder🇬🇦
StoneCoder🇬🇦 - avatar
7 Answers
18th Jan 2018, 9:34 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 13
@John Dooe Really !! as The Best !! 😆 Thanks a lot mate !! 👍 && I'm really honored !! 🤗
21st Jan 2018, 11:55 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
@mustacacqn can your code doesn't seem to capitalize the first later of every string, plus will be good if you provide the code in the playground so we try...
17th Jan 2018, 11:34 AM
StoneCoder🇬🇦
StoneCoder🇬🇦 - avatar
+ 2
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int number = Integer.parseInt(scan.nextLine()); String [] names = new String [number]; for (int i = 0; i < names.length; i++) { names[i] = scan.nextLine(); System.out.println(names[i]); } for (int i = 0; i < names.length; i++) { System.out.println( (i+1) + ". Name: " + names[i] ); } }
16th Jan 2018, 9:57 PM
mustafacqn can
mustafacqn can - avatar
+ 1
Well everything is as expected though their all on the same line😊. Just put all the name on a new line like above.
21st Jan 2018, 12:25 PM
StoneCoder🇬🇦
StoneCoder🇬🇦 - avatar
21st Jan 2018, 10:48 PM
Zsombor Sándor
Zsombor Sándor - avatar