
web.xml Welcome to Tomcat Welcome to Tomcat Calculator Calculator Calculator /calc Calculator.jsp 계산기 + - * / Calculator.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /..

import java.util.Scanner; public class Calc { // 재귀 public static int calc(String input) { int pos; // indexof(); - 문자가 없으면 -1반환 pos = input.indexOf('+'); // +의 위치를 알려줘! System.out.println(input); if (pos != -1) { // 문자가 있으니까 -1이 아니여야 함 return calc(input.substring(0, pos)) + calc(input.substring(pos + 1)); } else { pos = input.indexOf('-'); if (pos != -1) { return calc(input.substring(0, pos)) -..