Question: https://repl.it/@IbrahimYurdan/ShimmeringLongPackages#Main.java CAN YOU GUYS EXPLAIN THIS CODE PLEASE? import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in);

https://repl.it/@IbrahimYurdan/ShimmeringLongPackages#Main.java

CAN YOU GUYS EXPLAIN THIS CODE PLEASE?

 https://repl.it/@IbrahimYurdan/ShimmeringLongPackages#Main.java CAN YOU GUYS EXPLAIN THIS CODE PLEASE? import java.util.Scanner; public

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner kb = new Scanner(System.in);

System.out.println("Please enter an equation: ");

String equation = kb.nextLine();

System.out.println(calc(equation));

}

public static String calc(String equation) {

String e = "";

for (int i = 0; i

if (Character.isWhitespace(equation.charAt(i)) == false) {

e += equation.charAt(i);

}

}

for (int i = e.length() - 1; i > 0; i--) {

if (e.charAt(i) == '+') {

double add = Double.parseDouble(calc(e.substring(0, i)))

+ Double.parseDouble(calc(e.substring(i + 1, e.length())));

return add + "";

} else if (e.charAt(i) == '-') {

double sub = Double.parseDouble(calc(e.substring(0, i)))

- Double.parseDouble(calc(e.substring(i + 1, e.length())));

return sub + "";

}

}

for (int i = e.length() - 1; i > 0; i--) {

if (e.charAt(i) == '*') {

double multi = Double.parseDouble(calc(e.substring(0, i)))

* Double.parseDouble(calc(e.substring(i + 1, e.length())));

return multi + "";

} else if (e.charAt(i) == '/') {

double divide = Double.parseDouble(calc(e.substring(0, i)))

/ Double.parseDouble(calc(e.substring(i + 1, e.length())));

return divide + "";

}

}

for (int i = e.length() - 1; i > 0; i--) {

if (e.charAt(i) == '^') {

double pow = Math.pow(Double.parseDouble(calc(e.substring(0, i))),

Double.parseDouble(calc(e.substring(i + 1, e.length()))));

return pow + "";

}

}

return equation;

}

1. User inputs 2. The solvelt() method a. Parameters b. The use of recursive calls C. How parameter variables are used to iterate values in the recursion. d. The return 3. A Demonstration of all features of the program running

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!