web123456

javaweb--Table Loop

  • <table>
  • <tr>
  • <%
  • Map<Integer,Integer> map=new HashMap<Integer,Integer>();
  • (1,100000);
  • (2,250000);
  • (3,80000);
  • (4,160000);
  • (5,79000);
  • (6,820000);
  • (7,431000);
  • (8,605550);
  • (9,120000);
  • (10,150000);
  • (11,230000);
  • (12,50000);
  • int minval=(1); //Get the minimum month value
  • int minstr=0; //Get the minimum value month
  • int maxval=(1); //Get the maximum month value
  • int maxstr=0; //Get the month of the maximum value
  • for (int st:()) {
  • if((st)>maxval){ //Judge the maximum value
  • maxval=(st); // Assign the value to maxval
  • maxstr=st; //The month corresponding to the maximum value is maxstr
  • }
  • if((st)<=minval){ //Judge minimum value
  • minval=(st); // Assign the value to mainval
  • minstr=st; // Assign the month corresponding to the minimum value to minstr
  • }
  • %>
  • <td>
  • <%
  • (st+"month"); //Output month
  • %>
  • </td>
  • <%
  • }
  • %>
  • </tr>
  • <tr>
  • <%
  • for (int str:()) { //Get all values
  • %>
  • <td>
  • <%
  • ((str)); //Output value all values
  • %>
  • </td>
  • <%
  • }
  • %>
  • </tr>
  • </table>
  • <p>
  • The most profitable month is <% (maxstr+"month");%>, and the profitable amount is <% (maxval); %><br/>
  • The month with the least profit is <% (minstr+"month");%>, and the amount of profit is <% (minval);%>
  • </p>