Java Program

You have been asked to write a Java program that will determine the performance of students undertaking OOP module during the Spring 20 semester.

import java.util.Scanner;

public class student
{
public static void main(String args[])
{
/* This program assumes that the student has 2 Semesters,
Each semester has weghtage of 50%/

    int marks[] = new int[2];
    int i;
    float weightage =0, TotalWeightage;
    Scanner scanner = new Scanner(System.in);

    for(i=0; i<2; i++) { 
       System.out.print("Enter Marks of Semester"+(i+1)+":");
       marks[i] = scanner.nextInt();
       weightage = weightage + marks[i];
    }
    scanner.close();
    //Calculating Total weightage(100%) = Semester1(50%) +Semester2(50%)
    TotalWeightage= weightage;
     System.out.print("The student Total Weightage of both semesters is: " + TotalWeightage +"\n");
    System.out.print("The student Grade is: ");
    if(TotalWeightage>=50)
    {
        System.out.print("PASS");
    }

    else
    {
        System.out.print("FAIL");
    }
}

}

Sample Solution