+ 2
Please somebody help me about thisđ
students = {"Pitok", "Kulos", "Pablo", "Yolanda", "Sen dong", "Agnes", "Margo", "Jenny", "Gloria", "Digong"} grades = {60,56,87, 92, 46,49,78,60,45,90} Arrays explained: The two given arrays are related in such a way that the student in the first element of the students array garnered a grade of the first element in the grades array. For example "Pitok" is the first element in the first array so his grade is 60 which is the first element in the second array. "Kulos" is the second element so his grade is 56, Pablo got 87 and so on. Among the ten students, who is the highest? Among the failed students, who is the highest? Who gets the lowest grade?
4 Answers
+ 5
Galendez Rodenze ,
as you just have started learning java in sololearn, i have my doubts that you can solve this task at the moment.
but anyway here some hints how it could be done:
âȘïžcreate an emptyp hashmap that can take pairs of name (string) and grade (integer)
âȘïžuse a loop that generates index numbers. use them to access the names array and the grades array.
âȘïžinside the loop you can add the retrieved pairs in the hashmap
âȘïžafter loop is done, the hashmap can be sorted by key or by value
âȘïžnow you can perform the required tasks
happy coding!
+ 3
What did you mean in the second question "Among the failed students, who is the highest?" I mean, you didn't specify the grade level for those who fail/pass.
+ 2
The recomendation of Martin Taylor with a class for own data type and additional ArrayList because of dynamically data sizing can you see here:
https://code.sololearn.com/cPCn2QFFcZ3e/?ref=app