Site icon DataFlair

Advanced Java Project – Temperature Conversion

Program 1

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
          
    </body>
</html>

Program 2

<%-- 
    Document   : CtoF
    Created on : Jan 8, 2024, 12:56:49 PM
    Author     : admin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <center>
              <form>  
             <table border="1">    
                 <tr>
                     <th>Enter Celsius</th>
                     <td><input type="text" name="txtc"></td>
                 </tr>
                 <tr>
                     <td></td>
                    <td><input type="submit" value="Fahrenheit"></td> 
                 </tr> 
             </table>    
              </form>     
         <%
           String str=null;    
           str=request.getParameter("txtc");
           
           if(str!=null)
           {     
              double c,f;
              c=Double.parseDouble(str);
              f=((c*9)/5)+32;  
              out.println("<font color=red size=6>Fahrenheit=</font> " + "<font size=6>"+f + "</font>");
           }   
         %>   
          </center>   
    </body>
</html>

Program 3

<%-- 
    Document   : CtoF
    Created on : Jan 8, 2024, 12:56:49 PM
    Author     : admin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <center>
              <form>  
             <table border="1">    
                 <tr>
                     <th>Enter Fahrenheit</th>
                     <td><input type="text" name="txtf"></td>
                 </tr>
                 <tr>
                     <td></td>
                    <td><input type="submit" value="Celsius"></td> 
                 </tr> 
             </table>    
              </form>     
         <%
           String str=null;    
           str=request.getParameter("txtf");
           
           if(str!=null)
           {     
              double c,f;
              f=Double.parseDouble(str);
               c=((f-32)*5)/9;  
              out.println("<font color=red size=6>Celsius=</font> " + "<font size=6>"+ c + "</font>");
           }   
         %>   
          </center>   
    </body>
</html>
Exit mobile version