postheadericon 23. Develop a interest calculation application in which user will provide all information in HTML form and that will be processed by servlet and response will be generated back to the user.



1. Using  Servlet

index.jsp


<html>
<head>
<title>EX-23</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:400px;
left:5in;
border-style:solid;
}
</style>

</head>
<body>

<div class="abc"  id="f1">
<br>
<form method="get" action="/Ex23/bipinrupadiya.blogspot.com">
<table align="center">
<tr>
<td colspan=2 align=center><h3>Simple Interest</h3><hr>
</td>
</tr>
<tr>
<td>Amount : </td>
<td><input type="text" name="p"></td>
</tr>
<tr>
<td>Rate :</td>
<td><input type="text" name="r"></td>
</tr>
<tr>
<td>Time :</td>
<td><input type="text" name="n"></td>
</tr>

<tr>
<td colspan=2 align=center>
<hr>
<input type="submit" value="Calculate">
<input type="reset" value="Clear">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>


Ex23.java


package bsr;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.WebServlet;

/** Ex23 simple Interest. by Bipin S rupadiya */

@WebServlet("/bipinrupadiya.blogspot.com")
public class Ex23 extends HttpServlet
{
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    {
        response.setContentType("text/html");
        PrintWriter out=response.getWriter();
     
        float p=Float.parseFloat(request.getParameter("p"));
        float r=Float.parseFloat(request.getParameter("r"));
        float n=Float.parseFloat(request.getParameter("n"));
        float i=(p*r*n)/100;
        out.println("<br><h1>Simple Interest will be : "+i);
    }
}



2. Using Java Beans (Form Beans)

index.jsp


<html>
<head>
<title>EX-23</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:400px;
left:5in;
border-style:solid;
}
</style>

</head>
<body>

<div class="abc"  id="f1">
<br>
<form method="POST" action="result.jsp">
<table align="center">
<tr>
<td colspan=2 align=center><h3>Simple Interest</h3><hr>
</td>
</tr>
<tr>
<td>Amount : </td>
<td><input type="text" name="p"></td>
</tr>
<tr>
<td>Rate :</td>
<td><input type="text" name="r"></td>
</tr>
<tr>
<td>Time :</td>
<td><input type="text" name="n"></td>
</tr>

<tr>
<td colspan=2 align=center>
<hr>
<input type="submit" value="Calculate">
<input type="reset" value="Clear">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>



result.jsp


<html>
<head>
<title>EX-23</title>
<style>
.abc
{
background:#ababff;
position:absolute;
top:2in;
hieght:200px;
width:400px;
left:5in;
border-style:solid;
}
</style>

</head>
<BODY>
<CENTER>


<jsp:useBean id="si" class="bsr.SimpleIntrest" />

<jsp:setProperty name="si" property="*" />

<div class="abc"  id="f1">
<br>
<table width="50%" align="center">
<tr>
<th colspan=2><h3> Simple Interest</h3><hr></th>
</tr>
<tr>
<td>Amount : </td>
<td><jsp:getProperty name="si" property="p" /></td>
</tr>
<tr>
<td>Rate :</td>
<td><jsp:getProperty name="si" property="r" /></td>
</tr>
<tr>
<td>Time :</td>
<td><jsp:getProperty name="si" property="n" /></td>
</tr>
<tr>
<td>Interest :</td>
<td><jsp:getProperty name="si" property="intrest" /></td>
</tr>
<tr>
<th colspan=2> <hr><a href="index.jsp">Home</a></th>
</tr>
</table>
</form>
</div>
</body>
</html>



SimpleIntrest.java [ JavaBean ]


package bsr;
public class SimpleIntrest
{
private float p=1;
private float r=1;
private float n=1;

// Principal Amount
public float getP()
{
return(p);
}
public void setP(float v)
{
this.p = v;
}

// Rate of Interest
public float getR()
{
return(r);
}
public void setR(float v)
{
this.r = v;
}

// Number of Years
public float getN()
{
return(n);
}
public void setN(float v)
{
this.n = v;
}

//Calculate Interest
public float getIntrest()
{
return((p*r*n)/100);
}
}



7 comments:

suvathi said...

I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.
Java Courses in chennai

Aruna Ram said...

Really appreciate for providing the valuable post and It was very helpful for my future. Thank you & Keep it up!!!
Oracle Training in Chennai
Oracle Training institute in chennai
Excel Training in Chennai
Job Openings in Chennai
Placement Training in Chennai
Pega Training in Chennai
Oracle DBA Training in Chennai
Tableau Training in Chennai
Power BI Training in Chennai
Social Media Marketing Courses in Chennai

Riya Raj said...

The way you have conveyed your blog is more impressive.... good Blog...
JAVA Training in Chennai
JAVA Course in Chennai
java institute in chennai
Best JAVA Training institute in Chennai
java training in Thiruvanmiyur
JAVA Training in Velachery
Python Training in Chennai
Software testing training in chennai
Python Training in Chennai
Selenium Training in Chennai

Durai Raj said...

Great blog!!! The information was more useful for us... Thanks for sharing with us...
Python Training in Chennai
Python course in Chennai
Python Training Institute in Chennai
Best Python Training in Chennai
Python training in porur
Python training in OMR
Big data training in chennai
Android Training in Chennai
IOS Training in Chennai
Selenium Training in Chennai

jose said...

Really nice post. Thank you for sharing amazing information.
Java Training in Chennai/Java Training in Chennai with Placements/Java Training in Velachery/Java Training in OMR/Java Training Institute in Chennai/Java Training Center in Chennai/Java Training in Chennai fees/Best Java Training in Chennai/Best Java Training in Chennai with Placements/Best Java Training Institute in Chennai/Best Java Training Institute near me/Best Java Training in Velachery/Best Java Training in OMR/Best Java Training in India/Best Online Java Training in India/Best Java Training with Placement in Chennai

sasi said...

I really enjoyed this article. I need more information to learn so kindly update it.
Salesforce Training in Chennai
salesforce training in bangalore
Salesforce Course in Chennai
best salesforce training in bangalore
salesforce institute in bangalore
salesforce developer training in chennai
web designing course in madurai
Hadoop Training in Bangalore

shalini said...

Keep sharing this blog. it look like very attractive content ....
Data Science Course in Chennai
Data Science Courses in Bangalore
Data Science Course in coimbatore
Data Science Course in Hyderabad
AWS Training in Bangalore
Devops Training in Bangalore
Data Science Training in Chennai
Data Science Training in Bangalore
Data Science Courses in Coimbatore
Data Science Training in Hyderabad

Follow by Email

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.