Posting this again because day limit has run out. Again I really need help with this....

Question:

Posting this again because day limit has run out. Again I really need help with this. This is for my Advanced Java Programming class. The book we use is Murach's Java Servlet's and JSP 3rd Edition. The program used is NetBeans IDE 8.2. I need help modifying or adding some code. I will post the code I was told to open that needs to be modified below.

Exercise 9-3     Use JSTL to add a table to the Future Value application.

In this exercise, you’ll use JSTL to add a table to the Future Value application showing the value of a series of monthly investments at the end of each year.

Review the project.

• Start NetBeans and open the project named ch09_ex3_futureValue that’s in the more_ex_starts directory.
• Open the FutureValueServlet class. Note that the code in the doPost method has been modified to create a list of calculation objects, one for each year starting at one and going up to the number of years entered by the user. Also, note that it stores an attribute named calculations in the request.

Modify the code.

• Open the index.jsp file. Then, modify it so it uses the JSTL choose tags instead of JSTL if tags.
• Open the result.jsp file. Then, modify it so it presents a table that displays the value of the investment for each year up to the year the user entered. To do this, you can use a JSTL forEach tag. When you’re done, the user interface should look something like this:

• Note that the Investment Amount, Yearly Interest Rate, and Number of Years fields are no longer working correctly. This is because the application stores multiple calculations instead of a single calculation.
• Fix the application so the second page displays the Investment Amount, Yearly Interest Rate, and Number of Years fields again. There are several ways to do this. Choose the way that you think works best.

Here is the code that I was informed to open. I need the above requirements to be met. This is all done in Java. Please I really need help with this thank you very much!

FutureValueServlet.java

package murach.fv;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;

@WebServlet("/calculate")
public class FutureValueServlet extends HttpServlet {

@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

// get parameters from the request
String investmentString = request.getParameter("investment");
String interestRateString = request.getParameter("interest_rate");

// validate the parameters
String url;
String message;
double investment = 0;
double interestRate = 0;
int years = 0;
try {
investment = Double.parseDouble(investmentString);
interestRate = Double.parseDouble(interestRateString);
message = "";
url = "/result.jsp";
} catch (NumberFormatException e) {
message = "Please enter a valid number in all three text boxes.";
url = "/index.jsp";
}
request.setAttribute("message", message);

// Create a calculation object for each year
List<Calculation> calculations = new ArrayList<Calculation>();
for (int i = 1; i <= years; i++) {
Calculation calculation = new Calculation();
calculation.setMonthlyInvestmentAmount(investment);
calculation.setYearlyInterestRate(interestRate);
calculation.setYears(i);
}

// Store calculations list in calculations object
request.setAttribute("calculations", calculations);
request.setAttribute("years", years);
request.setAttribute("message", message);

request.getSession().setAttribute("investment", investment);
request.getSession().setAttribute("interestRate", interestRate);

getServletContext()
.getRequestDispatcher(url)
.forward(request, response);
}

@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
}

index.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<section>
<h1>Future Value Calculator</h1>
<p><i>${message}</i></p> <form action="calculate" method="post"> <label>Investment Amount:</label> <c:if test="${investment != null}">
<input type="text" name="investment"
value="${investment}"/><br> </c:if> <c:if test="${investment == null}">
<input type="text" name="investment"
value="${calculation.monthlyInvestmentAmount}"/><br> </c:if> <label>Yearly Interest Rate:</label> <c:if test="${interestRate != null}">
<input type="text" name="interest_rate"
value="${interestRate}"/><br> </c:if> <c:if test="${interestRate == null}">
<input type="text" name="interest_rate"
value="${calculation.yearlyInterestRate}"/><br> </c:if> <label>Number of Years:</label> <input type="text" name="years" value="${calculation.years}"/><br>

<label>&nbsp;</label>
<input type="submit" value="Calculate"/><br>
</form>
</section>
<%@include file="footer.jsp" %>

result.jsp

<section>
<h1>Future Value Calculator</h1>

<label>Investment Amount:</label>
<span>${calculation.monthlyInvestmentAmountCurrencyFormat}</span><br /> <label>Yearly Interest Rate:</label> <span>${calculation.yearlyInterestRate}</span><br />

<label>Number of Years:</label>
<span>${calculation.years}</span><br /> <label>Future Value:</label> <span>${calculation.futureValueCurrencyFormat}</span><br />

<label>&nbsp;</label>
<span><a href="javascript:void(0)"> </section>
<%@include file="footer.jsp" %>

Please I really need help with this if a Java expert can help me I would appreciate it.

QUESTION 2 0.5 A vessel contains a mixture of 27.8 grams of H2 (g) and 16.0...
QUESTION 2 0.5 A vessel contains a mixture of 27.8 grams of H2 (g) and 16.0 grams of CH4. If the total pressure inside the vessel is measured at 3.21 atm, the partial pressure of H2(g) must be atm. O C 6.03 0.217 O O O O QUESTION 3 0.5 p Zinc reacts with aqueous sulfuric acid to form hydrogen gas: Z...
How do you solve \frac { ( b + 1) } { 2} = \frac { ( b - 2) } { 5}?
How do you solve \frac { ( b + 1) } { 2} = \frac { ( b - 2) } { 5}?...
Explain how nonhomologous morphological characters can reveal “deep homology,” and how deep homology can be considered...
Explain how nonhomologous morphological characters can reveal “deep homology,” and how deep homology can be considered a special case of homology and mapped as such onto a phylogenetic tree, as done by McCune and Shimenti. Please explain in depth...
I really need help understanding/interperting this graph. the question is : how much of mortatality rate for CVD can be...
I really need help understanding/interperting this graph. the question is : how much of mortatality rate for CVD can be reduced if people are most fit in CRF compared fo one with least fit? (answer for both men and women) Men 1.01 P for trend <0.001 in men and <0.001 in women Women 0.8 0.6 ...
A river penetrates a confined gravel aquifer of 2 m thickness and receives flow from the...
A river penetrates a confined gravel aquifer of 2 m thickness and receives flow from the aquifer on both banks. From both sides, the hydraulic gradient towards the river is 5 m/km. Over a linear section of the river between gauging stations 4 km apart, the river flow rate increases by 1000 litres pe...
If F(x)=int_1^(x^2)sqrt(t^2+3)dt, then F'(2)=?
I anti-differentiated this function and plugged the value in, I got sqrt(19)^3*8/3-16/3. However, the correct answer is 4sqrt(19). Is my answer wrong or I need to simplify it? If so, how? Thank you!...
A model rocket has a horizontal range of 260 m on level ground, when given a...
A model rocket has a horizontal range of 260 m on level ground, when given a 45 degrees launch angle. What horizontal distance will the rocket cover when launched at 45 degrees to the horizontal from the top of a hill whose sides slope down at 25 degrees?...
5, D33. Geographic separation is an important factor in 03 speciation. allopatric parapatric anagenesis sympatric
5, D33. Geographic separation is an important factor in 03 speciation. allopatric parapatric anagenesis sympatric...