Question: This application will give you a chance to use a for loop. It asks the user to enter a number from 1 through 100 with

This application will give you a chance to use a for loop. It asks the user to enter a number from 1 through 100 with this prompt dialog box:

Then, it adds all the numbers from one to the users entry and displays the sum of the numbers in an alert dialog box like this:

Then, to give the user a chance to do multiple entries, this dialog box is displayed:

2. In the script element, add a do-while loop that prompts the user for an entry from 1 through 100. If the entry is invalid, display an alert box with this message: Please enter a number between 1 and 100. Then, continue the loop until the entry is valid.

3. After the do-while loop, code a for loop that sums the numbers, and then display the second dialog box above. For instance, the sum for an entry of four is 1 + 2 + 3 + 4.

4. Add a do-while loop around all of the code that uses the third dialog box above to determine whether the first dialog box should be displayed again so the user can enter another number. The application should end for any entry other than y.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!