Answer to Question #281992 in Java | JSP | JSF for Candy

Question #281992

Write if-else statement that outputs

Student must achieve at least 40 in the exam grade and 70% in the attendance in order to pass the module (print out “You pass the module!”). If the student fails the attendance only, the student needs to take classes to make up the attendance (print out ”Please take classes to make up your attendance.”) . If the student fails the exam grade only, the student is eligible to apply re-exam (print out “You are eligible for re-exam”). If the student fails both the exam and the attendance, the student needs to retake the whole module (print out Please retake the module”).

The variables attendance is of type double, and grade is of type int.

if (______________________ ) {

_______________________________________________________

}

elseif (___________________) {

______________________________________________________

}

elseif (___________________) {

______________________________________________________

}

else {

______________________________________________________

}


1
Expert's answer
2021-12-22T14:18:59-0500


import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		System.out.print("Enter the exam grade: ");
		int grade = keyBoard.nextInt();
		System.out.print("Enter the attendance: ");
		double attendance = keyBoard.nextDouble();


		if (grade >= 40 && attendance >= 70) {
			System.out.println("You pass the module!");
		} else if (grade >= 40 && attendance < 70) {
			System.out.println("Please take classes to make up your attendance.");
		} else if (grade < 40 && attendance >= 70) {
			System.out.println("You are eligible for re-exam");
		} else {
			System.out.println("Please retake the module");
		}


		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog