Results 1 to 3 of 3
Thread: Simple tax Calcularot help
- 05-07-2007, 03:14 PM #1
Member
- Join Date
- May 2007
- Posts
- 6
- Rep Power
- 0
Simple tax Calcularot help
Hi All. Very New to the JSTL devlopment tool. I really need help in this simple tax calculator program. Basically, it prompts the user to enter his income. And at the click of the calculate text button, the tax amount pops up at the Your text amount part. I can't seem to get the tax amount to pop up. I have managed to get my form validation to work though. Any help will be greatly appreciated.
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head><title>Question 4</title>
<script type="text/javascript">
function verify() {
regExp = /\d+\b/;
if (!(regExp.test(thisForm.income.value))) {
alert("You must enter valid income amount!");
return false;}
return true;
}
</script>
</head>
<body>
<fmt:setLocale value="en-US" />
<c:set var="amount" value="${param.income}" scope = "application"/>
<c:if test='${empty param.income}'>
<c:set var="amount" value="0"/>
</c:if>
<fmt:setLocale value="en-US" />
<c:set var="tax" value="${param.tax}" scope = "application" />
<b>Enter the amount of total income for this year:</b>
<form name="thisForm" action="Question4.jsp" method="post"
onsubmit="return verify();">
Amount of sales:<input name=income size=10 value=""> <br/><br/>
<input type=submit value="Calculate Tax">
</form>
// I believe there are errors here. Can't seem to find out where.
<%-- the following code is to calculate the tax --%>
<c:choose>
<c:when test =" ${param.income} > '1' && ${param.income} < '3000'}"
> double tax = '0'
</c:when>
<c:when test=" ${param.income} > '3001' && ${param.income} < '10000'}"
> double tax = (amount * (105/100))
</c:when>
<c:when test=" ${param.income} > '10001'}"
> double tax = (amount * (107/100))
</c:when>
</c:choose>
Your tax amount: <c:out value="tax" />
</body>
</html>
- 06-12-2012, 05:08 PM #2
Member
- Join Date
- Jun 2012
- Posts
- 1
- Rep Power
- 0
Re: Simple tax Calcularot help
Hi! I found your question a interesting one! Did you get the answer to you in the end?
Do you mind sharing it with me? :) Thanks in advance man!!! :)
- 06-12-2012, 05:18 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Similar Threads
-
I need a simple programs
By mikau in forum New To JavaReplies: 2Last Post: 02-11-2008, 03:37 AM -
Simple java
By abhiN in forum New To JavaReplies: 1Last Post: 01-16-2008, 10:13 AM -
simple GUI
By dim_ath in forum New To JavaReplies: 3Last Post: 01-07-2008, 03:00 PM -
Probably a really simple question...
By ibanez270dx in forum New To JavaReplies: 0Last Post: 11-16-2007, 01:27 AM -
Seems so simple yet I can't figure it out!
By adamhaviland in forum New To JavaReplies: 1Last Post: 11-03-2007, 06:26 PM


LinkBack URL
About LinkBacks

Bookmarks