2
|
1 |
//@file TemperatureTable.jsp /nodynamiccopyright/ hard coded linenumbers in other tests - DO NOT CHANGE
|
|
2 |
import java.io.*;
|
|
3 |
import java.util.*;
|
|
4 |
// import javax.servlet.*;
|
|
5 |
// import javax.servlet.http.*;
|
|
6 |
|
|
7 |
public class TemperatureTableServlet /* extends HttpServlet */{
|
|
8 |
public static void main(String[] args) {
|
|
9 |
// public void doGet(HttpServletRequest request, HttpServletResponse response)
|
|
10 |
// throws IOException, ServletException {
|
|
11 |
HelloWorld.main(args); // so we can we non-JSP code too
|
|
12 |
PrintStream out = System.out;
|
|
13 |
// response.setContentType("text/html");
|
|
14 |
// PrintWriter out = response.getWriter();
|
|
15 |
//@line 1
|
|
16 |
out.println("<html>");
|
|
17 |
//@line 2
|
|
18 |
out.println("<head>");
|
|
19 |
//@line 3
|
|
20 |
out.println(" <title>Temperature Table</title>");
|
|
21 |
//@line 4
|
|
22 |
out.println("</head>");
|
|
23 |
//@line 5
|
|
24 |
out.println("<body>");
|
|
25 |
//@line 6
|
|
26 |
out.println("");
|
|
27 |
//@line 7
|
|
28 |
out.println("<h1>Temperature Table</h1>");
|
|
29 |
//@line 8
|
|
30 |
out.println("<p>American tourists visiting Canada can use this handy temperature");
|
|
31 |
//@line 9
|
|
32 |
out.println("table which converts from Fahrenheit to Celsius:");
|
|
33 |
//@line 10
|
|
34 |
out.println("<br><br>");
|
|
35 |
//@line 11
|
|
36 |
out.println("");
|
|
37 |
//@line 12
|
|
38 |
out.println("<table BORDER COLS=2 WIDTH=\"20%\" >");
|
|
39 |
//@line 13
|
|
40 |
out.println("<tr BGCOLOR=\"#FFFF00\">");
|
|
41 |
//@line 14
|
|
42 |
out.println("<th>Fahrenheit</th>");
|
|
43 |
//@line 15
|
|
44 |
out.println("<th>Celsius</th>");
|
|
45 |
//@line 16
|
|
46 |
out.println("</tr>");
|
|
47 |
//@line 17
|
|
48 |
out.println("");
|
|
49 |
//@line 18
|
|
50 |
for (int i = 0; i <= 100; i += 10) {
|
|
51 |
//@line 19
|
|
52 |
out.println("<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">");
|
|
53 |
//@line 20
|
|
54 |
out.println("<td>" + i + "</td>");
|
|
55 |
//@line 21
|
|
56 |
out.println("<td>" + ((i - 32) * 5 / 9) + "</td>");
|
|
57 |
//@line 22
|
|
58 |
out.println("</tr>");
|
|
59 |
//@line 23
|
|
60 |
}
|
|
61 |
//@line 24
|
|
62 |
out.println("");
|
|
63 |
//@line 25
|
|
64 |
out.println("</table>");
|
|
65 |
//@line 26
|
|
66 |
out.println("<p><i>Created " + new Date () + "</i></p>");
|
|
67 |
//@line 27
|
|
68 |
out.println("");
|
|
69 |
//@line 28
|
|
70 |
out.println("</body>");
|
|
71 |
//@line 29
|
|
72 |
out.println("</html>");
|
|
73 |
}
|
|
74 |
}
|