Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program with 5 arrays. Names(10) ID(10) Score1(10) Score2(10) Score3(10)

ID: 3573194 • Letter: W

Question

Write a program with 5 arrays.

Names(10)

ID(10)

Score1(10)

Score2(10)

Score3(10)

Your program should display the following menu of choices to the user. It should perform the operations as suggested by the user and always come back to the menu and wait for the user to type in her/his choice.

Type P to populate the student information.

Type U to update student Information

Type D to display the student information.

Type C to calculate the Grade.

Type E to exit.

If the user types P
Ask the user to enter the 10 student names, ID’s , and score1, score2 and score 3 for each of the student. Return to the menu.

If the user types D then:
Ask the user to enter the ID of the student. Search for the student in the ID array and display student name, ID, score1, score2, score3. Return to the menu.

If the user types U then:
Ask the user to enter the ID of the student. Search for the student in the ID array and display student name, ID, score1, score2, score3. Ask the user to enter the new scores for the student. Update the Score1, Score2, and Score3 arrays at that position.

If the user types C then
Ask the user for the student ID. Find the student Id in the ID array. Calculate the average of the three scores for that student and display the grade of that student. The grade should be calculated based on the following criteria. If the average is between 90 and 100, then the grade is A. If the average is between 80 and 89, then the grade should be B. If the average is between 70 and 79, then grade should be C. If the average is between 70 and 69 then the grade should be D. If the average is below 60, then the grade is F. Return to the main menu

   If the user types E. then:
       Terminate the main program.

If the user types any other option

      Display the message “Invalid Choice. Try again” and go back and display the menu.

I need the solution in Basic language format to and it has to work with Liberty Basic software.

Thanks

Explanation / Answer

import java.util.Scanner;

public class student {
  
public static void main(String[] args) {
       String[] studentName = new String[10];
       String[] studentID = new String[10];
       int[] score1 = new int[10];
       int[] score2 = new int[10];
       int[] score3 = new int[10];
       boolean menu = true;
       char input = 0;
       while (menu) {
           System.out.println("Type P to populate the student information.");
           System.out.println("Type U to update student Information.");
           System.out.println("Type D to display the student information.");
           System.out.println("Type C to calculate the Grade. Type E to exit.");
           Scanner s = new Scanner(System.in);
           input = s.next().charAt(0);
           if (input == 'P') {
               for (int i = 0; i < studentName.length; i++) {
                   int j = i + 1;
                   System.out.println("Enter " + j + " student name:");
                   studentName[i] = s.next();
               }
               for (int i = 0; i < studentName.length; i++) {
                   int j = i + 1;
                   System.out.println("Enter " + j + " student ID:");
                   studentID[i] = s.next();
               }
               for (int i = 0; i < studentName.length; i++) {
                   int j = i + 1;
                   System.out.println("Enter " + j + " student Score1:");
                   score1[i] = s.nextInt();
               }
               for (int i = 0; i < studentName.length; i++) {
                   int j = i + 1;
                   System.out.println("Enter " + j + " student Score2:");
                   score2[i] = s.nextInt();
               }
               for (int i = 0; i < studentName.length; i++) {
                   int j = i + 1;
                   System.out.println("Enter " + j + " student Score3:");
                   score3[i] = s.nextInt();
               }

           } else if (input == 'U') {
               System.out.println("Please enter Student ID:");
               String ID = s.next();
               int k = 0;
               for (int i = 0; i < studentID.length; i++) {

                   String IDvalue = studentID[i];

                   if (ID.equals(IDvalue)) {
                       System.out.println("Student ID:" + studentID[i]);
                       System.out.println("Student Name:" + studentName[i]);
                       System.out.println("Score1:" + score1[i]);
                       System.out.println("Score2:" + score2[i]);
                       System.out.println("Score3:" + score3[i]);
                       k = i;
                   }
               }

               System.out.println("Please enter Updated Score1:");
               score1[k] = s.nextInt();
               System.out.println("Please enter Updated Score2:");
               score2[k] = s.nextInt();
               System.out.println("Please enter Updated Score3:");
               score3[k] = s.nextInt();
               System.out.println("Updated scores" + score1[k] + " "
                       + score2[k] + " " + score3[k]);

           } else if (input == 'D') {
               System.out.println("Please enter Student ID:");
               String ID = s.next();

               for (int i = 0; i < studentID.length; i++) {

                   String IDvalue = studentID[i];

                   if (ID.equals(IDvalue)) {
                       System.out.println("Student ID:" + studentID[i]);
                       System.out.println("Student Name:" + studentName[i]);
                       System.out.println("Score1:" + score1[i]);
                       System.out.println("Score2:" + score2[i]);
                       System.out.println("Score3:" + score3[i]);
                   }
               }

           } else if (input == 'C') {
               System.out.println("Please enter Student ID:");
               String ID = s.next();
               int k = 0;
               for (int i = 0; i < studentID.length; i++) {
                   String IDvalue = studentID[i];
                   if (ID.equals(IDvalue)) {
                       k = i;
                   }
               }
               int sum = score1[k] + score2[k] + score3[k];
               int avg = sum / 3;
               String Grade = "";
               if ((avg <= 100) && (avg >= 90)) {
                   Grade = "A";
               } else if ((avg <= 80) && (avg >= 89)) {
                   Grade = "B";
               } else if ((avg <= 70) && (avg >= 79)) {
                   Grade = "C";
               } else if ((avg <= 60) && (avg >= 69)) {
                   Grade = "D";
               } else if (avg < 60) {
                   Grade = "F";
               }
               System.out
                       .println("Grade of " + studentName[k] + "is:" + Grade);
           } else if (input == 'E') {
               menu = false;
           } else {
               System.out.println("Invalid choice Try again");
           }
       }
   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote