Enter an integer number n:
Execute
Sum even
(When the web page runs, if the interface is not the same as above, 0.5 points will be deducted)
Assume that users fill an integer into the textfield (called n).
When users click "Execute" button, the browser makes a request to /sum using Post method (TheServlet is configured in web.xml) (0.5 point):
a. Check validate input n:
- If users input a value is not an integer number > 5, show the error text "You must input an integer> 5" to servlet. (0.5 point)
- If users do not choose any option, show the error text "You must choose an option" to servlet.(0.5 point)
b.Execute:
- If users choose "Sum odd" option, sum the odd numbers from 1 to n, then output the result to
servlet (Example: n=6 output: 9). (0.5 point)- If users choose "Sum even" option, sum the even numbers from 1 to n, then output the result to servlet (Example: n=6→ output: 12). (0.5 point)
Question 2:(2.0 points)
You are given a NetBeans template project (read more detail in the first page).
Your tasks
+ 100%
Zoom
Close