Answered step by step
Verified Expert Solution
Question
1 Approved Answer
complete this use java The main method shown below should compute the average final grade for a course. The array midterm contains the midterm grade
complete this use java
The main method shown below should compute the average final grade for a course.
The array midterm contains the midterm grade (out of 100) for the students in the course. There are never missing midterm grades.
The array exam contains the midterm grade (out of 100) for the students in the course. A value of -1 indicates that the exam was not written.
midterm[i] and exam[i] are the grades for the same student.
The final grade for a student is computed using the following rules:
if the exam grade is missing then the final grade is -1 (incomplete)
if the exam grade is not missing then the final grade is computed as 25% of the midterm grade plus 75% of the exam grade rounded to the nearest integer value (use Math.round to perform the rounding)
Finally, the average grade for the course is computed as the average grade over all of the students who completed the course (students with an incomplete final grade are not included in the calculation of the average).
Complete the main method so that it:
computes the array grade containing the final grade for each student in the course
computes the value avg equal to the average grade as described above
You should assume that whoever is marking your work will change the arrays midterm and exam, however, you may assume that at least one student completes the course and that the arrays both have the same size.
You can submit your work by filling in the textbox below, or by uploading your .java file containing the main method.
You do not need to use methods in your solution (but you may) and you do not need to include any comments.
You may use Arrays.toString to print an array, but you must not use any other classes in your solution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started