Write a program using INPUT (with prompt) to accept registration number, name, class, section and marks in physics, chemistry and biology (all marks are out of 30). Calculate the total, average and percentage. Print all the details:
registration number
name
class
section marks in physics, chemistry and biology.
Total, average and percentage.
Answers
Answer:
import java.util.Scanner;
public class KboatAvgNStream
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter marks in Physics: ");
int phy = in.nextInt();
System.out.print("Enter marks in Chemistry: ");
int chem = in.nextInt();
System.out.print("Enter marks in Biology: ");
int bio = in.nextInt();
double avg = (phy + chem + bio) / 3.0;
if (avg < 40)
System.out.println("No stream");
else if (avg < 60)
System.out.println("Commerce");
else if (avg < 80)
System.out.println("Bio-Science");
else
System.out.println("Computer Science");
Explanation:
hope it helps uhh
Answer: import java.util.Scanner;
public class KboatAvgNStream
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter marks in Physics: ");
int phy = in.nextInt();
System.out.print("Enter marks in Chemistry: ");
int chem = in.nextInt();
System.out.print("Enter marks in Biology: ");
int bio = in.nextInt();
double avg = (phy + chem + bio) / 3.0;
if (avg < 40)
System.out.println("No stream");
else if (avg < 60)
System.out.println("Commerce");
else if (avg < 80)
System.out.println("Bio-Science");
else
System.out.println("Computer Science");
Explanation: