Question: Java Coding Only. Thank you. Write a java program that takes a list of numeric grades and then takes any single grade and displays what
Java Coding Only. Thank you.
Write a java program that takes a list of numeric grades and then takes any single grade and displays
what the rank of the single grade is compared to the list of grades previously entered. Here are the
specifications:
Accept a list of grades Assume max of type integer. The list will be part of the command
line.
Get a single grade from of type integer.
Compare single grade to the list of grades and output what the rank of the single grade is
Keep getting single grades from user until a negative ie grade is entered.
Example:
java ClassRank
Enter Single Grade:
Class Rank
Enter Single Grade:
Class Rank tie
Enter Single Grade:
program terminated
Requirements:
Get the list of grades from the command line. Look at page in text to see how to do
that. Convert list from string to integer.
Use a bubble sort to sort list of numbers. See link in this Moodle section for how to implement a
bubble sort.
If single grade matches a grade on the list, display tie along with the rank
Some Psudocode to help:
Read list of values from the command line and store them in an array Value: Position: Create a Bubble Sort for the algorithm you can use. Send the array to the bubble sort method and sort it in Descending order Create a loop that gets single grades from the user. Exit the loop if its a negative number
a Get a single grade b Start at position c Is arrayposition single grade? d If it is Is arrayposition single grade? Yes: Print Class Rank is Tied at position No: Print Class Rank is position Else Increment Position by Position Value Position Value Get a single grade If single grade isnt negative, continue loop from step c
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
