Computer Applications
An ICSE school displays a notice on the school notice board regarding admission in Class XI for choosing stream according to marks obtained in English, Maths and Science in Class 10 Council Examination.
Marks obtained in different subjects | Stream |
---|---|
Eng, Maths and Science >= 80% | Pure Science |
Eng and Science >= 80%, Maths >= 60% | Bio. Science |
Eng, Maths and Science >= 60% | Commerce |
Print the appropriate stream allotted to a candidate. Write a program to accept marks in English, Maths and Science from the console.
Java
Java Conditional Stmts
86 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 English: ");
int eng = in.nextInt();
System.out.print("Enter marks in Maths: ");
int maths = in.nextInt();
System.out.print("Enter marks in Science: ");
int sci = in.nextInt();
if (eng >= 80 && sci >= 80 && maths >= 80)
System.out.println("Pure Science");
else if (eng >= 80 && sci >= 80 && maths >= 60)
System.out.println("Bio. Science");
else if (eng >= 60 && sci >= 60 && maths >= 60)
System.out.println("Commerce");
else
System.out.println("Cannot allot stream");
}
}
Variable Description Table
Program Explanation
Output
Answered By
36 Likes
Related Questions
A courier company charges differently for 'Ordinary' booking and 'Express' booking based on the weight of the parcel as per the tariff given below:
Weight of parcel Ordinary booking Express booking Up to 100 gm ₹80 ₹100 101 to 500 gm ₹150 ₹200 501 gm to 1000 gm ₹210 ₹250 More than 1000 gm ₹250 ₹300 Write a program to input weight of a parcel and type of booking (`O' for ordinary and 'E' for express). Calculate and print the charges accordingly.
The standard form of quadratic equation is given by: ax2 + bx + c = 0, where d = b2 - 4ac, is known as discriminant that determines the nature of the roots of the equation as:
Condition Nature if d >= 0 Roots are real if d < 0 Roots are imaginary Write a program to determine the nature and the roots of a quadratic equation, taking a, b, c as input. If d = b2 - 4ac is greater than or equal to zero, then display 'Roots are real', otherwise display 'Roots are imaginary'. The roots are determined by the formula as:
r1 = (-b + √(b2 - 4ac)) / 2a , r2 = (-b - √(b2 - 4ac)) / 2aAn air-conditioned bus charges fare from the passengers based on the distance travelled as per the tariff given below:
Distance Travelled Fare Up to 10 km Fixed charge ₹80 11 km to 20 km ₹6/km 21 km to 30 km ₹5/km 31 km and above ₹4/km Design a program to input distance travelled by the passenger. Calculate and display the fare to be paid.
A bank announces new rates for Term Deposit Schemes for their customers and Senior Citizens as given below:
Term Rate of Interest (General) Rate of Interest (Senior Citizen) Up to 1 year 7.5% 8.0% Up to 2 years 8.5% 9.0% Up to 3 years 9.5% 10.0% More than 3 years 10.0% 11.0% The 'senior citizen' rates are applicable to the customers whose age is 60 years or more. Write a program to accept the sum (p) in term deposit scheme, age of the customer and the term. The program displays the information in the following format:
Amount Deposited Term Age Interest earned Amount Paid xxx xxx xxx xxx xxx