Answer:
Step-by-step explanation:
In order to calculate the weighted average, the grade itself is multiplied by the percentage of the category and then these values are summed. This sum is then divided by the total percentage of the portfolio.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
double sumOfWeights = 100;
Scanner in = new Scanner(System.in);
System.out.println("Please Enter Homework Grade: ");
double homework = in.nextDouble() * 20;
System.out.println("Please Enter Labs Grade: ");
double labs = in.nextDouble() * 15;
System.out.println("Please Enter Midterm Grade: ");
double midterm = in.nextDouble() * 25;
System.out.println("Please Enter Final Grade: ");
double finals = in.nextDouble() * 40;
double average = (homework + labs + midterm + finals) / sumOfWeights;
System.out.println("The Average of these Weighted Grades is " + average);
}
}