write a method public static void sortstudentswithmajor string students that takes a 5155562

Write a method public static void sortStudentsWithMajor(String[] students) that takes a list of strings that represents a group of students’ names and their majors. In particular, the string at index i gives a student’s name, and the string at index i+1 gives the student’s major. The method sorts the (name, major) pairs so as to alphabetize the students by their names. (Recommendation: adapt the bubble sort code). The examples below will help to clarify what the method accomplishes. Note that the argument students itself is sorted, and the method returns no value. In Java

import java.util.Arrays; public class Lab8 { public static void main(String[] args) { System.out.println(“Part 1 outputs:”); String[] s1 = {“Mike”, “CSE”, “Alice”, “AMS”, “Bob”, “ECE”, “Amber”, “CSE”, “Luke”, “MAT”, “Linda”, “AMS”, “David”, “MEC”}; System.out.println(“Before: ” + Arrays.toString(s1)); sortStudentsWithMajor(s1); System.out.println(“After: ” + Arrays.toString(s1)); String[] s2 = {“Alice”, “AMS”, “Bob”, “ECE”, “Amber”, “CSE”, “Roger”, “KOR”, “Mike”, “ESE”, “Luke”, “BIO”, “Linda”, “FRN”, “David”, “MEC”, “Erin”, “TSM”}; System.out.println(“Before: ” + Arrays.toString(s2)); sortStudentsWithMajor(s2); System.out.println(“After: ” + Arrays.toString(s2)); String[] s3 = {“Linda”, “FRN”, “Bob”, “ECE”, “Alice”, “AMS”, “Amber”, “CSE”, “Roger”, “KOR”, “Mike”, “ESE”, “Xavier”, “PHY”, “Leo”, “PHI”, “Luke”, “BIO”, “David”, “MEC”, “Erin”, “TSM”}; System.out.println(“Before: ” + Arrays.toString(s3)); sortStudentsWithMajor(s3); System.out.println(“After: ” + Arrays.toString(s3)); } // Part 1 public static void sortStudentsWithMajor(String[] students) { }

Write a method public static void sortStudentsWithMajor (String[] students) that takes a list of strings that represents a gr

Write a method public static void sortStudentsWithMajor (String[] students) that takes a list of strings that represents a group of students' names and their majors. In particular, the string at index i gives a student's name, and the string at index i+1 gives the student's major. The method sorts the (name, major) pairs so as to alphabetize the students by their names. (Recommendation: adapt the bubble sort code from the lecture notes!) The examples below will help to clarify what the method accomplishes. Note that the argument students itself is sorted, and the method returns no value. Lab Assignment #8 CSE 114 Summer 2019 Examples: students Before Method Call: [Mike, CSE, Alice, AMS, Bob, ECE, Amber, CSE, Luke, MAT, Linda, AMS, David, MEC] students After Method Call: [Alice, AMS, Amber, CSE, Bob, ЕСЕ, David, MEC, Linda, AMS, Luke, MAT, Mike, CSE students Before Method Call: Alice, AMS, Bob, ECE, Amber, CSE, Roger, KOR, Mike, ESE, Luke, BIO, Linda, FRN, David, MEC, Erin, TSM] students After Method Call: [Alice, AMS, Amber, CSE, Bob, ЕСЕ, David, MEC, Erin, TSM, Linda, FRN, Luke, BIO, Mike, ESE, Roger, KOR] students Before Method Call: [Linda, FRN, Bob, ECE, Alice, AMS, Amber, cSE, Roger, KOR, Mike, ESE, Хavier, PHY, Leo, PHI, Luke, BIO, David, MEC, Erin, TSM] students After Method Call: [Alice, AMS, Amber, CSE, Bob, ECE, David, MEC, Erin, TSM, Leo, PHI, Linda, FRN, Luke, BIо, Mike, ESE, Roger, KOR, Хavier, PHY]

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now