-
Notifications
You must be signed in to change notification settings - Fork 0
/
src_Bob.java
142 lines (137 loc) · 6.41 KB
/
src_Bob.java
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import java.util.Scanner;
public class Bob {
public static void main(String[] args) {
class YES {
int Working = 1;
Scanner YesorNo = new Scanner(System.in);
String YorN;
String Yes = "Yes";
String No = "No";
int YN = 1;
public void bob() {
System.out.println("Do you want to continue with the calculator? Yes or No");
while (YN == 1) {
YorN = YesorNo.nextLine();
if (YorN.equals(Yes)) {
System.out.println("You would like to continue!");
YN = 0;
} else if (YorN.equals(No)) {
System.out.println("You would not like to continue");
Working = 2;
YN = 0;
} else {
System.out.println("Invalid answer! Make sure the first letter is capatalized!");
System.out.println("Try again! Yes or No");
}
}
}
}
YES hi = new YES();
int Working;
Working = 0;
int pinNumber;
Scanner input = new Scanner(System.in);
System.out.println("ENTER YOUR PIN");
pinNumber = input.nextInt();
while (pinNumber != 8173) {
System.out.println("INCORRECT PIN TRY AGAIN");
System.out.println("ENTER YOUR PIN");
pinNumber = input.nextInt();
}
System.out.println("Welcome to the Matrix" +
" Now You can access everything there is to offer!!");
String name;
Scanner UserInput = new Scanner(System.in);
System.out.println("What is your name?");
name = UserInput.nextLine();
System.out.println("Hello " + name + "!");
int Age;
System.out.println("what is your age?");
Age = UserInput.nextInt();
if (Age >= 13) {
System.out.println("Congratulations you are over bar mitzvah because you are " + Age);
} else if (Age < 13) {
System.out.println("You are almost bar mitzvah because your are " + Age);
} else {
System.out.println("You did not provide a number so we will continue!");
}
Scanner Calculator = new Scanner(System.in);
String Calc;
String Addition;
String Subtraction;
String Multiplication;
String Division;
Subtraction = "Subtract";
Multiplication = "Multiply";
Division = "Divide";
Addition = "Add";
String YorN = "Hey";
String No = "Hey";
int YN = 2;
while (Working == 0) {
System.out.println("Welcome to the calculator world. Would you like to Add, Subtract, Multiply, or Divide?");
Calc = Calculator.nextLine();
if (Calc.equals(Addition)) {
System.out.println("You would like to add. Please type in your first number that you want to add");
int FirstN;
FirstN = Calculator.nextInt();
System.out.println("Your first number is " + FirstN + " Now please type in your second number you would like to add");
int SecondN;
SecondN = Calculator.nextInt();
System.out.println("Your second Number is " + SecondN + " Now I will do my magic and add your numbers together");
System.out.println("Calculating...");
int Final;
Final = FirstN + SecondN;
System.out.println("Your final answer is " + Final);
hi.bob();
}
if (Calc.equals(Subtraction)) {
System.out.println("You would like to Subtract. Please type in your first number that you want to Subtract");
int FirstN;
FirstN = Calculator.nextInt();
System.out.println("Your first number is " + FirstN + " Now please type in your second number you would like to subtract");
int SecondN;
SecondN = Calculator.nextInt();
System.out.println("Your second Number is " + SecondN + " Now I will do my magic and subtract your numbers from eachother");
System.out.println("Calculating...");
int Final;
Final = FirstN - SecondN;
System.out.println("Your final answer is " + Final);
hi.bob();
}
if (Calc.equals(Multiplication)) {
System.out.println("You would like to multiply. Please type in your first number that you want to multiply");
int FirstN;
FirstN = Calculator.nextInt();
System.out.println("Your first number is " + FirstN + " Now please type in your second number you would like to multiply");
int SecondN;
SecondN = Calculator.nextInt();
System.out.println("Your second Number is " + SecondN + " Now I will do my magic and multiply your numbers together");
System.out.println("Calculating...");
int Final;
Final = FirstN * SecondN;
System.out.println("Your final answer is " + Final);
hi.bob();
}
if (Calc.equals(Division)) {
System.out.println("You would like to divide Please type in your first number that you want to divide");
int FirstN;
FirstN = Calculator.nextInt();
System.out.println("Your first number is " + FirstN + " Now please type in your second number, which is the denominator");
int SecondN;
SecondN = Calculator.nextInt();
System.out.println("Your second Number is " + SecondN + " Now I will do my magic and divide your numbers from eachother");
System.out.println("Calculating...");
int Final;
int Remainder;
Remainder = FirstN % SecondN;
Final = FirstN / SecondN;
System.out.println("Your final answer is " + Final + " Your remainder is " + Remainder);
hi.bob();
} else{
System.out.println("Invalid answer. Try Again!! Make sure the first letter is capitalized!!");
}
}
System.out.println("Congratulations you finished working on the calculator");
}
}