forked from lineage-merlin/JAVA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestYourBasicBodmasKnowledge
47 lines (34 loc) · 1.15 KB
/
TestYourBasicBodmasKnowledge
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
35
36
37
38
39
40
41
42
43
44
45
46
47
package GitHub;
import java.util.Scanner;
public class ProgramOne {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("This program is going to test your basic bodmas skills");
System.out.println("Enter 1 to enter the test or 0 to exit.");
int a = sc.nextInt();
if(a == 1) {
System.out.println("Welcome to the test: ");
System.out.println("Enter a number A: ");
int A = sc.nextInt();
System.out.println("Enter another number B: ");
int B = sc.nextInt();
System.out.println("Enter another number C: ");
int C = sc.nextInt();
System.out.println("Enter another number D: ");
int D = sc.nextInt();
System.out.println();
System.out.println("Enter the value of the equation ( A - B ) + C * D ");
int yourAnswer = sc.nextInt();
int RightAnswer = ( A - B ) + C * D;
if(yourAnswer == RightAnswer) {
System.out.println("Congratulations! You have passed the test");
}
else {
System.out.println("You have failed the test, your answer is wrong.");
}
}
else {
System.out.println("Thank you for visiting this program");
}
}
}