Computer Applications
Admission in a professional course is subject to the following criteria:
- Marks in Physics >= 70
- Marks in Chemistry >= 60
- Marks in Mathematics >= 70
- Total marks in all subjects >= 225
Or
Total marks in Physics and Mathematics >= 150
Write a program in Java to accept marks in these 3 subjects (Physics, Chemistry, and Mathematics) and display if a candidate is eligible.
Java
Java Conditional Stmts
19 Likes
Answer
import java.util.Scanner;
public class KboatAdmission
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter marks in Physics: ");
int p = in.nextInt();
System.out.print("Enter marks in Chemistry: ");
int c = in.nextInt();
System.out.print("Enter marks in Mathematics: ");
int m = in.nextInt();
int t = p + c + m;
int pm = p + m;
if (p >= 70 && c >= 60 && m >= 70
&& (t >= 225 || pm >= 150))
System.out.println("Eligible");
else
System.out.println("Not Eligible");
}
}
Output
Answered By
8 Likes
Related Questions
Write a program that reads a month number and displays it in words.
Using the ternary operator, create a program to find the largest of three numbers.
Write a program that will read the value of x and compute the following function:
Using the switch statement in Java, write a program to display the name of the city according to the user's choice.
D — Delhi, M — Mumbai, K — Kolkata, C — Chennai