Write a program to accept names of few persons then arrange them in ascending order | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Write a program to accept names of few persons then arrange them in ascending order

11th Nov 2017, 2:32 AM
Babita Agrawal
Babita Agrawal - avatar
6 Réponses
+ 41
can u show the code plzz //☺ edit ::: u must have given the code but its time to go , so see this code by Steasy //its also use sort method of array //u can try more ways , happy coding ☺ https://code.sololearn.com/cdDYwlr48uUJ/?ref=app
11th Nov 2017, 2:45 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 36
System.out.print("homework\ndo yourself"); //hint : U can use Array.sort(array name); & many more ways are also available ☺
11th Nov 2017, 2:37 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
in what order please?
11th Nov 2017, 5:02 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
I m 16 yrs old and I had tried but the output is not coming
11th Nov 2017, 2:41 AM
Babita Agrawal
Babita Agrawal - avatar
+ 1
Age doesn't matter. My 16 year old could write it in his sleep. Do it in little pieces. Read the names in and print them as you get them. Once that works, change it to read all the names first, followed by print them all. After that works, add the sorting. If a step doesn't work and you can't figure it out, post the code and ask for help.
11th Nov 2017, 4:10 AM
John Wells
John Wells - avatar
+ 1
John means: First create a code hint "loop" to run names and print out it. if it works, go to next step for Arrays Create a String array, add array to your loop and print out it into loop. If you run names twice, then it works. Now add array sorting hint "Google". Then create one more loop to read sorted array and print out it. hint "for each loop" easier. Check example Gaurav added. If it doesn't work, add your last try on code here, then we can help.
12th Nov 2017, 8:42 AM
Ferhat Sevim
Ferhat Sevim - avatar