Java Blog

 
 
 
----------------------------------------------------------------------------------
                    HTML File
----------------------------------------------------------------------------------
<html>
<head Premium Details>
<title Premium Details>
</title>
</head>

<body>
<form name=\"form2\" method=\"GET\" action=\"/q2/try2.do\">
<BR><h1>Insurance Premium</h1><br>

<input type=radio value=\"25Years\" checked=True name=optyr>25 Years
<input type=radio value=\"30Years\" name=optyr>30 Years
<br><br>

<input type=radio value=\"House Wife\" checked=True name=optw>House Wife
<input type=radio value=\"Working Woman\" name=optw>Working Woman
<br><br>

<input type=submit value=SUBMIT>
</form>
</body>
</html>

-------------------------------------------------------------------------------------------------
                    Java File
-------------------------------------------------------------------------------------------------

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Insurance extends HttpServlet
{
       public void doGet(HttpServletRequest req, HttpServletResponse res) throws 
       IOException, ServletException
       {
               PrintWriter out=res.getWriter();
               double amt=0.0, total_amt=0.0;

               out.write(\"<html>\");
               out.write(\"<head>\");
               out.write(\"<title>\");
               out.write(\"</title>\");
               out.write(\"<body>\");

               String yr=req.getParameter(\"optyr\");
               if(yr.equalsIgnoreCase(\"25Years\"))
               {
                      amt=4000;
               }               
               if(yr.equalsIgnoreCase(\"30Years\"))
               {
                      amt=3000;
               }               
               String hf=\"House Wife\";
               String status=req.getParameter(\"optw\");

               out.write(\"<h1>Insurance Premium Details</h1><br><br>\");

               if(hf.equalsIgnoreCase(status))
               {
                       total_amt=amt-((5*amt)/100);
               }
               else
               {
         total_amt=amt;
               }   

               out.write(\"<br><br>\");
               out.write(\"<br><br>\");               
               out.write(\"Total Amount of Insurance Premium : \"+total_amt);  
               out.write(\"</body>\");
               out.write(\"</html>\");        
               out.close();
        }
}    

    Related Post:
  1. Program to show the use of If Statement

  2. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

  3. Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server

  4. Program to show the use of Bitwise Operator (&) AND

  5. File handling program to display directory contents

  6. Program to read the ballots and count the votes cast for each candidate using an array variable count

  7. Program of insertion sort

  8. Program to determine the sum of the following harmonic series for a given value of n

  9. Program to show the use of operator (&lt;&lt;) Shift Left filling with zero from the right

  10. Program to show the use of Labeled Break Statement

  11. Given a list of marks ranging form 0 to 100, write a program to compute and print the number of students marks

  12. corba program of client and a DNS server where given a URL the server sends back an IP address

  13. An applet program to draw Polygon Graph with given data

  14. An application that combines several classes and interface

  15. Program to Display Output in triangular shape

  16. Program that enabled applet calculator

  17. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  18. Program to show the use of Switch Statement for the same statement for several different case labels

  19. Program of date server and client

  20. Program to print triangle of numbers