Question: import java.util.Scanner; public class Gradebook { // main method public static void main(String [] args) { Scanner input= new Scanner(System.in); // Create 2 String arrays


Search with a student name to know the student total grade Makethe search method first. . Input / parameter: the user provided name(String), the array for names (String []) Process: Use a FOR loop,


import java.util.Scanner; public class Gradebook {

// main method public static void main(String [] args) { Scanner input= new Scanner(System.in); // Create 2 String arrays for stud ID and names String [] studID = {"G001", "G002", "G003", "G004", "G005"}; String [] studName = {"Mary", "Abby", "Joe", "Mark", "Julie"}; // Create 2 double arrays for grades double [] mGrade = new double[5]; double [] fGrade = new double[5]; // Enter grades System.out.printf("please enter midterm exam grade for %d students. ", mGrade.length); for(int i = 0; i

// Display the grade tablel // Table head and separating line System.out.println("|ttStud IDtt|ttStud Namestt|ttMidtermtt|ttFinaltt|"); System.out.println("-------------------------------------------------------------------------"); //Student records for (int i = 0; i

Search with a student name to know the student total grade Make the search method first. . Input / parameter: the user provided name (String), the array for names (String []) Process: Use a FOR loop, to read each element in the name array and compare with the user provided name: if (name[i].equals (userInputName)) //or using equalsIgnoreCase() Output: When the above if condition is true, return the i value for the element index. If after you go through the entire name array and cannot find a matching name, after the loop block, return -1 (an invalid / meaningless value for the index number)

Step by Step Solution

3.50 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

java import javautilScanner public class GradeBookHW public static void mainString args Scanner input new ScannerSystemin Create 2 String arrays for s... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!