//JAVA_HOME: J:/JDK131
//J2EE_HOME: J:/J2EE131
//TOMCAT_HOME: C:/JBuilder6/jakarta-tomcat-3.2.3
//Classpath = .;J:/JDK131/lib/tools.jar;J:/J2EE131/lib/j2ee.jar;J:/_JavaT;J:/J2EE131/lib/classes
//J:/JavaT/banks/Int_Calc.java
import java.io.*;
import java.sql.*;
import java.util.*;
public class Int_Calc {
private String amount;
privatedo
uble int_amount;
private String period;
privatedo
uble int_period;
privatedo
uble rateInt;
private String rate1;
privatedo
uble interest;
public Int_Calc() {
}
public String getAmount() { return amount;
}
public void setAmount(String value) {
amount = value;
int_amount =do
uble.parseDouble(amount);
}
public void setPeriod(String value) {
period = value;
int_period =do
uble.parseDouble(period);
}
public String getPeriod() { return period;
}
public void setRate1(String value) {
rate1 = value;
rateInt =do
uble.parseDouble(rate1);
System.out.println(rateInt);
}
public String getRate1() { return rate1;
}
publicdo
uble getInterest() {
interest = (int_period * int_amount * rateInt) / 100;
return interest;
}
}
//Interest_calc.jsp
<html>
<head>
<title>Money Banks, Inc. -- Interest Calculator</title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
</head>
<%@ page language="java" %>
<%@ page errorPage="error.jsp" %>
<jsp:useBean id="IntCalc" class="Int_Calc" scope="page"/>
<body bgcolor="#ccccFF" bgproperties="fixed">
<p>&nbsp;</p>
<table width="100%" border="0" height="42">
<tr>
<td height="36" width="50%"><b><i><font size="5">Money Banks, Inc.</font></i></b></td>
<td height="36" width="50%">&nbsp;</td>
</tr>
</table>
<p align="center"><b><font size="4">Interest Calculator</font></b></p>
<table width="100%" border="0">
<tr>
<td width="36%"><b><font size="4">Enter Principal Amount:</font></b></td>
<td width="64%">
<%= (String)request.getParameter("amount") %>
<%! int amt;
%>
<% String str1 = request.getParameter("amount");
str1 = str1.trim();
%>
<jsp:setProperty name="IntCalc" property="amount" value="<%=str1%>"/>
</td>
</tr>
<tr>
<td width="36%"><b><font size="4">Enter Period in Months:</font></b></td>
<td width="64%">
<%= (String)request.getParameter("period") %>
<% String prd = request.getParameter("period");
prd = prd.trim();
%>
<jsp:setProperty name="IntCalc" property="period" value="<%=prd%>"/>
</td>
</tr>
<tr>
<td width="36%"><b><font size="4">Enter Rate of Interest:</font></b></td>
<td width="64%">
<%= (String)request.getParameter("int_rate") %>
<% String str2 = request.getParameter("int_rate");
str2 = str2.trim();
%>
<jsp:setProperty name="IntCalc" property="rate1" value="<%=str2%>"/>
</td>
</tr>
<tr>
<td width="36%"><font size="4"><b>Interest</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Payable:</b></font></td>
<td width="64%">
<%do
uble tot_int = IntCalc.getInterest();
out.println(tot_int);
%>
</td>
</tr>
</table>
<p align="center"><input type="button" value="OK" name="OK" onClick="show_Home()"></p>
<script language="JavaScript">
function show_Home() {
open("Home_page.htm");
}
</script>
</body>
</html>