SHARE
TWEET

controleHotel.jsp

Momnteiror2m Sep 6th, 2016 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%--
  2.    Document   : controleHotel
  3.    Created on : 06/09/2016, 21:17:41
  4.    Author     : aluno
  5. --%>
  6.  
  7. <%
  8.    String qtd = request.getParameter("qtdDias");
  9.    
  10.    int quant = 0;
  11.    double conta = 0;
  12.    
  13.    try{
  14.        quant = Integer.parseInt(qtd);
  15.        for(int i = 1; i <=quant; i++){
  16.            conta = conta + (double)100/i;
  17.        }
  18.    } catch(NumberFormatException erro){
  19.        quant = 0;
  20.        conta = 0;
  21.    }
  22.    
  23.    session.setAttribute("conta", conta);
  24.    response.sendRedirect("mostradorHotel.jsp");
  25. %>
RAW Paste Data
Top