CIS 120 Exam 2 Programming QuestionCreate a new Project and Class called Exam2_YourName. Please write your name in the class name. Your program will have a main method and two other methods called gradeCalculator and calculateAverage. Submit all the .java file called Exam2_YourName. Also ,copy and paste your code into a .docx file and upload the file as well. Please use the exam2 dropbox to submit your code.Your main method does the following :1)Create a 5-element array called subjectMarks that will carry numeric marks (double data type) of a student in five different subjects. Each mark can be a real number such as 40.5, 35.6 etc. Declare the array appropriately.2)Fill the array with values: Prompt the user to enter the student’s mark in each subject, one by one and use those values to fill the elements of the subjectMarks array one by one.3)Call the calculateAverage method and pass on the subjectMarks array as a parameter. This method will return the average mark of the student. Print out the average mark of the student on the console with proper comments. Use any required variable (for example- name it avgMark) to store the average mark value returned by the method.4)Call the gradeCalculator method and pass on to this method as a parameter, the variable that contains the average mark (avgMark as obtained in step 3). This method (gradeCalculator ) calculates the letter grade based on the student’s average and returns a String that will be the letter grade of the student. Print out this letter grade into the console. You may use a variable name letterGrade to hold the letter grade returned by the method. Write the code for the calculateAverage method. The calculateAverage method has the following features:1)This method will take in as a parameter/argument the array containing marks of the student (as in subjectMarks array). 2)This method returns a double value corresponding to the average marks of the student. You may declare a double variable called avgMark that will contain the average marks.3)This method calculates the average marks by taking one element of the array at a time, adding them to find the total marks. You may use a variable called totalMark to hold the total mark. After adding all the elements (,or marks), divide the total marks with the length of the array ( which givesthe number of subjects), to obtain the average marks. Return the average marks carried by the variable avgMarks. Anastasia Declin
Found this document preview useful?
Visual Studio Project | Assignment On C# Console Applicationlg...
SIT105 Critical Thinking and Problem Solving | Reportlg...
Java program to grade students based on quizzes and examslg...