Solved by verified expert:File name: StudentTOPICSObject ArraysString ArraysPrimitive ArraysDESCRIPITIONWrite a program that will compute and display the final grades for students in a class. A student’s final grade is determined from the scores obtained in the class exams. Each student in the class may be given a different number of exams as determined by the instructor. The final grade is determined by the average of the scores in all the exams given. For each student, the program will input student id, name, the number of exams given and scores in each of the exams. The scores in each of the exams will vary from 0 to 100. Each exam will carry the same weight. The final grade will be computed by taking the average of the scores in all the exams given (i.e. by adding the scores in all the exams and dividing it with the number of exams given). The final grade will be assigned depending upon the percentage of total points in the exams given as follows:A – 90 to 100%B – 80 to 89%C – 70 to 79%D – 60 to 69%F – 0 to 59%INSTRUTIONSUse a String variable for keeping final grade. For comparing two strings use the method: equals( ) or equalsIgnoreCase ( ). For details about using these methods of String class, consult textbook.IMPLEMENTATIONFor this assignment create the following classes.Student classCreate a class Student that provides the following:Private instance variables for holding student id (int), name (String), exam scores (an int array).A public constructor with parameters for initializing student id (int), name (String) and exam scores. The exam scores are passed as an array of int.A public method for returning the final grade as a String ( “A”, “B” etc).Accessor (getter) methods for getting student id and name.TestStudent classWrite a class TestStudent containing the main method.Method mainThe method main will do the following:Prompt the user to enter the total number of students (say n).Create an array of n references (for holding n Student object references). (The Student objects will be created in the next step).Create n Student objects. Do this by setting up an n count loop. In each pass through the loop, do the following:a.Ask the user to enter data for one student in a single dialog box.b.Separate data elements using a StringTokenizer object.c.Create a Student object initialized with data provided by the user and store its reference in the appropriate element of the array of student references created above.Display the student results by grade type. First display all students with grade A, then all students with grade B etc. Do this using one of the following two methods. (It is suggested that you use method II as it will help you to learn about String arrays).Method I.Create five empty Strings, outA, outB, outC, outD, outF. Use the String outA for storing output relating to A students; use String outB for storing output relating to B students; etc. Use the object accessor methods to access object values as needed. At the end, prepare a String outAll that concatenates all the above five Strings. Then display the String outAll. Method II.Create a String array out of 5 Strings. Use out [0] for accumulating output relating to A students, out[1] for B students etc. Write a static method displayRestult to display output. Call the static method displayResult and pass it the array out.displayResultFor method II above, write a static method displayResult. This method will receive a String array and display the contents of all elements of the String array one by one. Here is a proposed header for the method:public static void displayResult (String [ ] s){}You may use either the method I or method II above. However, it is suggested that you use method II as it teaches you how to use String arrays.The sample code given below uses method II for doing the output.SAMPLE CODE//The sample code below use method II discussed above for doing the outputpublic class Student{ private int id; private String name; private int [] exams; public Student(int id, String n, int [] ex) { //Below id refers to local variable. //this.id refers to the instance variable. this.id = id; name = n; //create exams array of same length as ex array exams = new int [ex.length]; //copy contents from array ex to exams System.arraycopy(ex, 0, exams, 0, ex.length); } public String findGrade() { String grade; //enter code here for finding the final grade. return grade; } public int getId ( ) { return id; } public String getName ( ) { return name; }}import javax.swing.*;import java.util.*;public class TestStudent{ public static void main(String[] args) { String in, name, token; int nStudents, id, nExams; int [] scores; in = JOptionPane.showInputDialog(“Enter number of students”); nStudents = Integer.parseInt(in); // Create an array of nStudents references Student [] st = new Student [nStudents]; // Create nStudents objects for (int i = 0; i < st.length; i++) { // Input one student data in = JOptionPane.showInputDialog("Enter one student data"); // Tokenize student data using StringTokenizer // Create Student object st [i] = new Student (id, name, scores); } // Find student grades // Create an array out of 5 string references String [] out = new String [5]; //Create 5 String objects. Initialize each with “” //and store their references in the above array of references. for (int i=0; i You will get a plagiarism-free paper and you can get an originality report upon request. All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades How it works
Will the writer plagiarize my essay?
Is this service safe?
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more