Cant calculate the weighted average score for each category and the total score for the student
or assign a letter grade.

package teacher_grade;

import java.util.Scanner;

public class teacher {

    public static void main (String[] args) {
         //Scanner objective    
        Scanner Scanner = new Scanner (System.in);

         double assignmentScore;
         double quizScore;
         double midtermScore;
         double finalScore;
         char grade;
         char YN;
    do{  
    System.out.println("Enter Student First Name");
        String studentFirst1 = Scanner.nextLine();
    System.out.println("Enter Student Last Name");
        String studentLast1 =  Scanner.nextLine();
    System.out.println("Enter Student ID");
        String studentidNum= Scanner.nextLine();
    System.out.println("Enter Average Assigment Score");
        assignmentScore = Scanner.nextDouble();
    System.out.println("Enter Average Quiz Score");
        quizScore = Scanner.nextDouble();
    System.out.println("Enter Average Midterm Score");
        midtermScore = Scanner.nextDouble();
    System.out.println("Enter Average final Score");

        finalScore = Scanner.nextDouble();
            Scanner.nextLine();

        /* calculate the score for each section 
        Assignments (worth 50%)
        Quizzes (worth 20%)
        Midterm Exam (worth 10%)
        Final Exam (worth 20%) */

    double assignMentworth = 0.50 * assignmentScore;
    double quizWorth = 0.20 * quizScore;
    double midtermWorth = 0.10 * midtermScore;
    double finalWorth = 0.20 * finalScore;
    double totalScore = assignMentworth + quizWorth + midtermWorth + finalWorth;

    /*90 - 100 = A
        80 - 89 = B
        70 - 79 = C
        60 - 69 = D
        59 and below = E
        */
    char lettergrade;
    if (totalScore >= 100.90)
        lettergrade = 'A';
    else if (totalScore >= 89.80)
        lettergrade = 'B';
    else if (totalScore >= 79.70)
        lettergrade = 'C';
    else if (totalScore >= 69.60)
        lettergrade = 'D';
    else 
        lettergrade = 'E';
    /*4.Print the results in the following format:

        Name: [Last Name], [First Name] 
        Student ID: [Student ID] 
        Assignments: [weighted average] 
        Quizzes: [weighted average] 
        Midterm Exam: [weighted average] 
        Final Exam: [weighted average]
        Total: [total score]
        Final Grade: [letter grade]
        */

    System.out.printf("Name [%s], [%s]\n", studentLast1,  studentFirst1);
    System.out.printf("Student ID number: [%s]\n", studentidNum);
    System.out.printf("Assignments:[%4.1f]\n", assignMentworth);
    System.out.printf("Quiz:[%4.1f]\n", quizWorth);
    System.out.printf("Midterm:[%4.1f]\n", midtermWorth);
    System.out.printf("Final:[%4.1f]\n ", finalWorth);
    System.out.printf("Final Grade[%c]\n", lettergrade);

        // have user ender another student or end 
        System.out.println("Enter another student? (Y/N):");
        YN = Scanner.nextLine().charAt(0);

        } while (YN == 'Y' || YN == 'y');
    }

}

Shouldn't this post be in Java section?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.