You are required to write a code that requires the user to enter positive integer numbers consecutively until a negative value is entered. The code should output the following numbers in the same order: maximum entered even number, miniumum entered even number, the average of all entered even numbers, maximum entered odd number, minimum entered odd number, the average of all entered odd numbers. If the user does not enter any even number, then the code should output the word None instead of the even numbers statistics. Similarly, if the user does not enter any odd number, then the code should output the word None instead of the odd numbers statistics.

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

c++, please solve the questionnnnnn

Sample Test Case 0
Input:
4 8 200 0 3 62 5 9 -6
Output:
200 0 54.8
93 5.66667
Sample Test Case 1
Input:
46 18 2-1
Output:
46 2 22
None
Sample Test Case 2
Input:
-3
Output:
None
None
Transcribed Image Text:Sample Test Case 0 Input: 4 8 200 0 3 62 5 9 -6 Output: 200 0 54.8 93 5.66667 Sample Test Case 1 Input: 46 18 2-1 Output: 46 2 22 None Sample Test Case 2 Input: -3 Output: None None
You are required to write a code that requires the user
to enter positive integer numbers consecutively until
a negative value is entered. The code should output
the following numbers in the same order: maximum
entered even number, miniumum entered even
number, the average of all entered even numbers,
maximum entered odd number, minimum entered
odd number, the average of all entered odd
numbers.
If the user does not enter any even number, then the
code should output the word None instead of the
even numbers statistics. Similarly, if the user does not
enter any odd number, then the code should output
the word None instead of the odd numbers statistics.
IMPORTANT NOTES
I/O
• Do not add any cout statements except for the final
answers as shown in the sample cases. Do not add
"Enter a number", "The maximum odd number is"
or any similar prompts.
• There is exactly one space between the maximum,
the minimum, and the average of the entered even
number not add any unnecessary spaces.
• There is exactly one space between the maximum,
the minimum, and the average of the entered odd
numbers. Do not add any unnecessary spaces.
• The grader is case-sensitive; so "none" is wrong but
"None" is correct.
Program Input:
Non-negative integer values until a negative
value is entered.
Program Output:
The output is two lines. The first line contains
the maximum enetered even number, the
minimum entered even number, and the
average of all entered even numbers. Each two
numbers are separated by a space. When no
even numbers are entered, the first line
contains None. The second line contains the
maximum enetered odd number, the minimum
entered odd number, and the average of all
entered odd numbers. Each two numbers are
separated by a space. When no odd numbers
are entered, the second line contains None.
Transcribed Image Text:You are required to write a code that requires the user to enter positive integer numbers consecutively until a negative value is entered. The code should output the following numbers in the same order: maximum entered even number, miniumum entered even number, the average of all entered even numbers, maximum entered odd number, minimum entered odd number, the average of all entered odd numbers. If the user does not enter any even number, then the code should output the word None instead of the even numbers statistics. Similarly, if the user does not enter any odd number, then the code should output the word None instead of the odd numbers statistics. IMPORTANT NOTES I/O • Do not add any cout statements except for the final answers as shown in the sample cases. Do not add "Enter a number", "The maximum odd number is" or any similar prompts. • There is exactly one space between the maximum, the minimum, and the average of the entered even number not add any unnecessary spaces. • There is exactly one space between the maximum, the minimum, and the average of the entered odd numbers. Do not add any unnecessary spaces. • The grader is case-sensitive; so "none" is wrong but "None" is correct. Program Input: Non-negative integer values until a negative value is entered. Program Output: The output is two lines. The first line contains the maximum enetered even number, the minimum entered even number, and the average of all entered even numbers. Each two numbers are separated by a space. When no even numbers are entered, the first line contains None. The second line contains the maximum enetered odd number, the minimum entered odd number, and the average of all entered odd numbers. Each two numbers are separated by a space. When no odd numbers are entered, the second line contains None.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Mathematical functions
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.
Similar questions
  • SEE MORE QUESTIONS
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