Results 1 to 3 of 3
  1. #1
    CoOlbOyCoOl is offline Member
    Join Date
    May 2007
    Posts
    6
    Rep Power
    0

    Default 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.

    <&#37;@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>

  2. #2
    lalala123 is offline Member
    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    Default 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!!! :)

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: Simple tax Calcularot help

    After 5 years?
    Seriously?
    Locking the thread.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. I need a simple programs
    By mikau in forum New To Java
    Replies: 2
    Last Post: 02-11-2008, 03:37 AM
  2. Simple java
    By abhiN in forum New To Java
    Replies: 1
    Last Post: 01-16-2008, 10:13 AM
  3. simple GUI
    By dim_ath in forum New To Java
    Replies: 3
    Last Post: 01-07-2008, 03:00 PM
  4. Probably a really simple question...
    By ibanez270dx in forum New To Java
    Replies: 0
    Last Post: 11-16-2007, 01:27 AM
  5. Seems so simple yet I can't figure it out!
    By adamhaviland in forum New To Java
    Replies: 1
    Last Post: 11-03-2007, 06:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •