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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 14E: In Chapter 4, you created a program that generates a random number, allows a user to guess it, and...
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT