-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMenuDriven.java
More file actions
34 lines (28 loc) · 1.08 KB
/
MenuDriven.java
File metadata and controls
34 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*Make a menu driven program. The user can enter 2 numbers, either 1 or 0.
If the user enters 1 then keep taking input from the user for a student’s marks(out of 100).
If they enter 0 then stop.
If he/ she scores :
Marks >=90 -> print “This is Good”
89 >= Marks >= 60 -> print “This is also Good”
59 >= Marks >= 0 -> print “This is Good as well” */
import java.util.*;
public class MenuDriven {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int input;
do {
int marks = sc.nextInt();
if(marks >= 90 && marks <= 100) {
System.out.println("This is Good");
} else if(marks >= 60 && marks <= 89) {
System.out.println("This is also Good");
} else if(marks >= 0 && marks <= 59) {
System.out.println("This is Good as well");
} else {
System.out.println("Invalid");
}
System.out.println("Want to continue ? (yes(1) or no(0))");
input = sc.nextInt();
} while(input == 1);
}
}