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);
}
}
Subscribe to:
Post Comments (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2012
(79)
-
▼
March
(7)
- 26.Develop an application to write a "page-composi...
- 27. You want to reduce the amount of Java coding i...
- 23. Develop a interest calculation application in ...
- 20. Write a JSP page, which uses the include direc...
- 19. Write a simple JSP page to display a simple me...
- 18. Develop a Servlet to authenticate a user, wher...
- 17. Develop a Servlet which looks for cookies for ...
-
▼
March
(7)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.
8 comments:
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
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
It's done quickly and cost-effectively. office 365
Thanks for the interesting blog that you have implemented here. Very helpful and innovative. Waiting for your next upcoming article.
Digital Marketing Course In Kolkata
python course in coimbatore
java course in coimbatore
python training in coimbatore
java training in coimbatore
php course in coimbatore
php training in coimbatore
android course in coimbatore
android training in coimbatore
datascience course in coimbatore
datascience training in coimbatore
ethical hacking course in coimbatore
ethical hacking training in coimbatore
artificial intelligence course in coimbatore
artificial intelligence training in coimbatore
digital marketing course in coimbatore
digital marketing training in coimbatore
embedded system course in coimbatore
embedded system training in coimbatore
Thanks for sharing this valuable information to our vision. You have posted a worthy blog keep sharing.
Digital Marketing Course In Kolkata
Web Design Course In Kolkata
SEO Course In Kolkata
python course in coimbatore
python training in coimbatore
java course in coimbatore
java training in coimbatore
android course in coimbatore
android training in coimbatore
php course in coimbatore
php training in coimbatore
digital marketing course in coimbatore
digital marketing training in coimbatore
software testing course in coimbatore
software testing training in coimbatore
Aivivu đại lý vé máy bay, tham khảo
giá vé máy bay đi Mỹ khứ hồi
vé máy bay đi sài gòn
vé máy bay đi hà nội hạng thương gia
đi máy bay ra đà lạt
ve may bay gia re di quy nhon
taxi sân bay hà nội giá rẻ
combo đà lạt 3 ngày 2 đêm 2021
Post a Comment