Skip to content

Commit 1a1247c

Browse files
committed
Optimizing Variables
1 parent c107f69 commit 1a1247c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎src/Assignments/Problems.java‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
import static java.lang.System.*;
66

77
public class Problems {
8+
9+
static Problems problems = new Problems();
10+
811
public static void main(String[] args) {
912

10-
Problems problems = new Problems();
1113
// problems.calculateSimpleInterest();
14+
problems.computeWithFormula();
15+
16+
}
17+
18+
void computeWithFormula(){
19+
1220
Scanner firstInput = new Scanner(in);
1321
out.println("Enter FirstNumber: ");
1422
int firstNumber = firstInput.nextInt();
@@ -21,10 +29,10 @@ public static void main(String[] args) {
2129
out.println("Enter Formula(Ex:- +,-,*,/): ");
2230
String symbol = symbolInput.next();
2331

24-
problems.computateTwoNumbers(firstNumber,secondNumber,symbol);
32+
problems.computeTwoNumbers(firstNumber,secondNumber,symbol);
2533
}
2634

27-
void computateTwoNumbers(int firstNumber, int secondNumber, String symbol){
35+
void computeTwoNumbers(int firstNumber, int secondNumber, String symbol){
2836

2937
switch (symbol) {
3038
case "+", "addition", "add" -> out.println("Addition of Two Numbers is " + (firstNumber + secondNumber));

0 commit comments

Comments
 (0)