Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

need help writing a simple code for this problem By the end of the semester stud

ID: 3550910 • Letter: N

Question

need help writing a simple code for this problem


By the end of the semester students in his class were required to do 2 take home essays, 3 in class writing

assignments, 1 in class quiz, and the midterm & final exams. The program you write must ask the user to input

the percent score for each of these items then calculate the final grade. The weights for each of the

assessments for this class is as follows:


Homework essay writing: 25%

In class writing assignments: 20%

In class quizzes: 15%

Midterm exam: 15%**

Final exam: 25%**


**In order to receive a passing grade in the course, the combined score of the midterm and final exams

must be greater than 50%.


The final grade must be displayed as both the percent and letter grade. You must also indicate if the student

failed the course because of low exam scores. You may use either JOptionPane or the console so long as it is

documented.

Explanation / Answer


import java.util.Scanner;
/**
* @author Steves
*
*/

public class GradeCalc {
public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        float ha, ca, cq,me,fa;
        double total;

        System.out.println("Enter Homework essay writing ");
        ha = s.nextFloat();
        System.out.println("Enter In class writing assignment ");
        ca = s.nextFloat();
        System.out.println("Enter In class quizzes ");
        cq = s.nextFloat();
        System.out.println("Enter Midterm exam ");
        me = s.nextFloat();
        System.out.println("Enter Final exam ");
        fa = s.nextFloat();
        //taking total by given weightages
        total = (float)(ha*0.25)+(ca*0.2)+(cq*0.15)+(me*0.15)+(fa*0.25);
        if(total >= 80){
            System.out.println("Grade A ");                       
        }else if(total >= 65){
            System.out.println("Grade B ");                       
        } else if(total >= 50){
            System.out.println("Grade C ");                       
        } else if(total < 50){
            System.out.println("Grade A ");                       
        }
        System.out.println(total);

    }
}