Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Dynamic Web Project in Eclipse, then create a servlet called AdditionPractice as follows: In doGet(), generate two random numbers between 1 and 9,

Create a Dynamic Web Project in Eclipse, then create a servlet called AdditionPractice as follows:

In doGet(), generate two random numbers between 1 and 9, and display a form that asks the user to enter the sum of the two numbers. For example, suppose the two random numbers are 8 and 2, the form should look like the following:

8 + 2 = textbox Submit button

You can use nextInt(int bound) method in Random to generate the random numbers.

In doPost(), display the correct answer, the user's answer, and tell the user if their answer is correct. For example, suppose the user entered the answer 9, the display should be:

8 + 2 = 10

Your answer 9 is incorrect.

Try Again

Clicking on Try Again should take the user back to the form with two new numbers.

The proper way to do this is to embed the two numbers in the form generated by doGet() using two hidden form fields, so they will be submitted to doPost() together with the user's answer.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago