An institution has decided to admit new candidates in different streams on the following criteria: Total marks obtained Stream offered 300 and above Science 200 and above but less than 300 Commerce Below 200 but not below 75 Arts Otherwise Admission is not granted, you have to appear in a qualifying examination WAP to take input total marks obtained in an examination and pint the stream allotted
import
java.util.*;
class
Eligibility
{
public static void main()
{
Scanner Sc=new Scanner(System.in);
System.out.println(“Enter the total marks scored “);
double total=Sc.nextDouble(); if(total>=300)
{
System.out.println(“Science”);
}
else if(total>=200&&total<300)
{
System.out.println(“Commerce”);
else if(total>=75&&total<200)
{
System.out.println(“Arts”);
}
else
{
System.out.println(“Admission not granted,youhave to appear in a qualifying examination”);
} } }
Output: Enter the total marks scored 310{
public static void main()
{
Scanner Sc=new Scanner(System.in);
System.out.println(“Enter the total marks scored “);
double total=Sc.nextDouble(); if(total>=300)
{
System.out.println(“Science”);
}
else if(total>=200&&total<300)
{
System.out.println(“Commerce”);
else if(total>=75&&total<200)
{
System.out.println(“Arts”);
}
else
{
System.out.println(“Admission not granted,youhave to appear in a qualifying examination”);
} } }
Science
No comments: