Write a program that determines whether a student is eligible for PG course or not. To be eligible, the student must have obtained more than 80% in X and XII examination, and 70% in graduation. If the student changes his stream (science, commerce, or arts), then deduct 5% from his Graduation score
Answers
import java.util.Scanner;
public class PG
{
public static void main(String args [])
{
Scanner sc=new Scanner(System.in);
System.out.print("Please enter your X examination percentage: ");
int X = sc.nextInt();
System.out.print("Please enter your XII examination percentage: ");
int XII = sc.nextInt();
System.out.print("Please enter your graduation percentage: ");
int grad = sc.nextInt();
int PG = (X+XII)/2;
System.out.print("Did You Change Your Stream?");
System.out.print("\nFrom Science to Commerce");
System.out.print("\nFrom Commerce to Science");
System.out.print("\nFrom Science to Arts");
System.out.print("\nFrom Arts to Science");
System.out.print("\nFrom Commerce to Arts");
System.out.print("\nFrom Arts to Commerce");
System.out.println("'y' or 'n'");
char yn = sc.next().charAt(0);
if (yn == 'y' || yn == 'Y')
{
grad -= 5;
if (PG >= 80 && grad >= 70)
{
System.out.println("Eligible For PG Course");
}
else
{
System.out.println("Not Eligible For PG Course");
}
}
else if (yn == 'n' || yn == 'N');
{
if (PG >= 80 && grad >= 70)
{
System.out.println("Eligible For PG Course");
}
else
{
System.out.println("Not Eligible For PG Course");
}
}
sc.close();
}
}