Question: a web application to function as a simple hand calculator that also keeps a paper trail of all your previous work. Details: Your program
a web application to function as a simple hand calculator that also keeps a "paper trail" of all your previous work.
Details:
Your program should consist of the following components:
An HTML page
This page is dynamically generated by JSP. It contains a trail of all the work you have done previously, for example something like this:
0.0 + 2.5 = 2.5 + 5.0 = 7.5 * 3.55 = 26.625 / -3.0 = -8.875 etc.
In addition, it should have the following HTML form elements: a text field in which you can enter numbers; add, subtract, multiply, and divide buttons; a clear button, to reset the current value to zero; and a clear all button, to reset the current value to zero and "erase" the paper trail (for when your page is getting too long and you want to start over).
Since the user should enter only numbers into the text field, use JavaScript to validate the numbers before you submit the form. (Hint: Google on "JavaScript validate input field.")
A servlet
The servlet should handle getting the request, calling some other class to do the work, and forwarding the result to JSP for formatting.
Along the way, the servlet should do session tracking, that is, it needs to keep track of the "paper trail" and the current value. I strongly recommend using the servlet tracking API, javax.servlet.http.HttpSession, as being the simplest and easiest way.
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
indexjsp is the view that takes input The request is transferred to ControllerServlet that servlet then calls the model class Calculationcalculate to do the calculation and return the result Servlet d... View full answer
Get step-by-step solutions from verified subject matter experts
