Question Details Part I: Print out the two arrays: (Be sure to do this first) An
ID: 3625625 • Letter: Q
Question
Question DetailsPart I: Print out the two arrays: (Be sure to do this first)
Anne 30
Bob 150
Ralph 305
Tim 225
Barbara 135
Jane 160
Steve 80
Tom 200
Mike 165
Shirley 90
Pam 100
Frank 120
Part II: The elevators in our building have an 1100 lb. load limit. Determine which people in the list above get on the elevator. Print their names, weights, total weight, and how many got on.
Part III: Rearrange these people in ascending sequence by weight and print the two arrays. Determine again how many may ride the elevator, printing out their names, weights, total weight and the number of how many people got on.
Part IV: Rearrange these people in ascending sequence by name (USE A DIFFERENT SORT ALGORITHM THAN THE ONE YOU USED IN PART II) and print the two arrays. Determine again how many may ride the elevator, printing out their names, weights, total weight and the number of how many people got on.
Part V: Have the program determine which of the three methods allowed the most people to get on the elevator – in order by arrival, by sorted weights, or by sorted names.
NOTE: You may hard code the data into the arrays and print the answers on the screen
REMEMBER: When you code a method, it should do one, and only one process, such as print the array, sort the array, or find how many people got on the elevator. Code a separate method for each of these processes. The client code (main) can then call the proper method in the order he/she needs them.
Explanation / Answer
well here is the complete program....... try part 5 urself i don't think it would be an issue or difficult cheers package elevator; public class Main { public static void main(String[] args) { String[] names={"Anne","Bob","Ralph","Tim","Barbara", "Jane","Steve","Tom","Mike","Shirley", "Pam","Frank "}; int[] weight={30,150,305,225,135,160,80,200,165,90,100,120}; for(int i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.