CSC110 Lab07a: Repetition - First Lab! Printed Copy of Each Java App Due Next Class Write a Java application named, Lab07a.java, that does the...
View the step-by-step solution to:

Question

# help with this one. use for or while loop whichever applies alt="9B0A4DB2-EDA5-47D2-9D73-A3CF3394CF3A.jpeg" /> ATTACHMENT PREVIEW Download attachment 9B0A4DB2-EDA5-47D2-9D73-A3CF3394CF3A.jpeg CSC110 Lab07a: Repetition - First Lab! Printed Copy of Each Java App Due Next Class Write a Java application named, Lab07a.java, that does the following actions: 15 Points 1. Asks the user for a maximum value to be used. Note: Assume the entered value is positive 2. Asks the user for the interval between the numbers to be added into the sum. Note: Assume the entered value is positive . Calculates the sum of the numbers from zero through the maximum value (first input) at the interval value entered above total sum Note: Example executions below help you to understand how the interval value determines the next value to be added to the Simply stated, the interval value is the result of subtracting any number added to the sum from the next number added to the sum. For example, when we see the program adding 6 and then adding 9, we know the interval value is 3 since 9 minus 6 is 3. 4. Display each number as it is being added to the total sum 5. Display the range of numbers, the interval value, and the resulting sum (see examples below) Here is one execution of your program, Lab07a.java, with the required actions above labelled: Enter the maximum number to be used: 2544 Action #1 Enter the interval between numbers to add: 8+ Adding 0 Action #2 Action #3 is NOT visible on the console Adding 8 Adding 16 Action #4 Adding 24 The sum of the numbers from 1 to 25 at interval, 8, is 48. Action #5 Carefully study at the details in the following FIVE example executions of your program: java Lab07a // First Example Execution Enter the maximum number to be used: 500 java Lab07a / / Fourth Example Execution Adding 0 Enter the interval between numbers to add: 100 Enter the maximum number to be used: 21 Adding 100 Enter the interval between numbers to add: 3 Adding 200 Adding 0 Adding 300 Adding 3 Adding 400 Adding 6 Adding 500 Adding 9 The sum of the numbers from 1 to 500 at interval, 100, is 1500. Adding 12 Adding 15 java Lab07a // Second Example Execution Adding 18 Enter the maximum number to be used: 10 Adding 21 Enter the interval between numbers to add: 1 The sum of the numbers from 1 to 21 at interval, 3, is 84. Adding 0 Adding 1 java Lab07a // Fifth Example Execution Adding 2 Enter the maximum number to be used: 12 Adding 3 Enter the interval between numbers to add: 2 Adding 4 Adding 0 Adding 5 Adding 2 Adding 6 Adding 4 Adding 7 Adding 6 Adding 8 Adding Adding 9 Adding 10 Adding 10 Adding 12 The sum of the numbers from 1 to 10 at interval, 1, is 55. The sum of the numbers from 1 to 12 at interval, 2, is 42. java Lab07a / / Third Example Execution Enter the maximum number to be used: 50 Enter the interval between numbers to add: 5 Adding 0 Adding 5 Adding 10 Adding 15 Adding 20 Adding 25 Adding 30 Adding 35 Adding 40 Adding 45 Adding 50 The sum of the numbers from 1 to 50 at interval, 5, is 275.

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents
• ### -

Question & Answers

Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

Ask a Question