Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in javascript: Sum of series using a function / Validate Input Use the prompt to query the user for two positive integers: start number and

in javascript: Sum of series using a function / Validate Input
Use the "prompt" to query the user for two positive integers: start number and end number. You may use the prompt command twice. Output to the console the sum of the numbers from start to end (inclusive) that are NOT divisible by 3 or 4.
Output (assume input is 1 and 10) Use the format below, note the quotes
2022Fall_mid1q1v3Output.png
Requirements
You MUST use a function to calculate the sum. Create a function per the following:
Input: start number and end number
Return: The sum of the numbers from the start number to the end number (inclusive) that are NOT divisible by 3 or 4.
A single number is returned. No other tasks are performed by the function.
Failure to use a function per the requirements, even if the output is correct, will result in an incorrect solution
For valid input, write the result on two lines as shown above
Show the start number and end number in quotes
Validate User Input
You must validate user input. Input must be two positive integers with the start number smaller than the ending number. User may not input alphanumeric, decimal, negative or blank data. For invalid data, display to the console an error a message using the below format (again, show data entered in quotes).
Sample error: Data entry contains negative integer or alphanumeric Note the quotes
2022Fall_mid1q1v3Error1.png
Sample error: Start number is less than end number Note the quotes
2022Fall_mid1q1v3Error2.png
Sample error: Decimal numbers Note the quotes
2022Fall_mid1q1v3Error3.png
Sample error: Valid integer and a blank Note the quotes

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

List unobtrusive techniques of data collection.

Answered: 1 week ago

Question

What is electric dipole explain with example

Answered: 1 week ago