Write a Class called ALG_GRD_002a to do the following: 1. Given a range from a given whole number a to some given maximum whole number b, as well as some given whole number q (that represents a batching constant), then: 1. Print out the sum of every batch of numbers q, and 2. Print out the sum of all whole numbers from a to the last number in that batch. Please validate your input parameters a, b, q as follows: 1=a

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Help
Problem ALGGRDO022
Write a Class called ALG_GRD_002a to do the following:
1. Given a range from a given whole number a to some given maximum whole number b, as well as
some given whole number q (that represents a batching constant), then:
1.
Print out the sum of every batch of numbers q; and
2
Print out the sum of all whole numbers from a to the last number in that batch.
Please validate your input parameters a, b, q as follows:
1 <= a< b:
a+1) must be
isible by q (to ensure
batch of numbers fits perfec
Note: if the above is not clear to you, the example below should make it very clear as to what
you should be doing.
Example:
For a = 101, b= 500, q- 40 your program must output:
Sum from 181 to 140: 4820
Sum from 101 to 140: 4820
Sum fron 141 to 180: 6420
Sum from 101 to 180: 11240
Sum fron 181 to 220: 8020
Sum from 181 to 220: 19260
Sum fron 221 to 260: 9620
Sum from 101 to 260: 28880
Sum fron 261 to 300: 11220
Sum fron 101 to 300: 40100
Sum fron 301 to 340: 12820
Sum fron 101 to 340: 52920
Sum from 341 to 380: 14420
Sum fron 101 to 380: 67348
Sum from 381 to 420: 16020
Sum fron 101 to 420: 8336A
Sum from 421 to 460: 17620
Sum fron 101 to 460: 100980
Sum fron 461 to 5e0: 19220
Sum fron 101 to 500: 120200
II
..
Transcribed Image Text:Problem ALGGRDO022 Write a Class called ALG_GRD_002a to do the following: 1. Given a range from a given whole number a to some given maximum whole number b, as well as some given whole number q (that represents a batching constant), then: 1. Print out the sum of every batch of numbers q; and 2 Print out the sum of all whole numbers from a to the last number in that batch. Please validate your input parameters a, b, q as follows: 1 <= a< b: a+1) must be isible by q (to ensure batch of numbers fits perfec Note: if the above is not clear to you, the example below should make it very clear as to what you should be doing. Example: For a = 101, b= 500, q- 40 your program must output: Sum from 181 to 140: 4820 Sum from 101 to 140: 4820 Sum fron 141 to 180: 6420 Sum from 101 to 180: 11240 Sum fron 181 to 220: 8020 Sum from 181 to 220: 19260 Sum fron 221 to 260: 9620 Sum from 101 to 260: 28880 Sum fron 261 to 300: 11220 Sum fron 101 to 300: 40100 Sum fron 301 to 340: 12820 Sum fron 101 to 340: 52920 Sum from 341 to 380: 14420 Sum fron 101 to 380: 67348 Sum from 381 to 420: 16020 Sum fron 101 to 420: 8336A Sum from 421 to 460: 17620 Sum fron 101 to 460: 100980 Sum fron 461 to 5e0: 19220 Sum fron 101 to 500: 120200 II ..
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education