Answered step by step
Verified Expert Solution
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 or
Output assume input is and Use the format below, note the quotes
FallmidqvOutput.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 or
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
FallmidqvErrorpng
Sample error: Start number is less than end number Note the quotes
FallmidqvErrorpng
Sample error: Decimal numbers Note the quotes
FallmidqvErrorpng
Sample error: Valid integer and a blank Note the quotes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started