Question: Write a program (placed in a src/main .cpp file for C++, src/main.py for Python and src/Assignment02.java for Java) that asks the user to enter positive

Write a program (placed in a src/main.cpp file for C++, src/main.py for Python and src/Assignment02.java for Java) that asks the user to enter positive integers (greater than 0) that are multiple of 3. For example, 3, 9, 24, and 81 are all positive multiples of 3, while 16, 7, 0, and 2 are not. The program must keep prompting the user for these integers until 5 positive multiples of 3 are entered. When that happens, the program must print a table-like summary of what was entered including:

Count: How many valid positive multiples of 3 were entered; it should always be 5.

Minimum and maximum: The smallest and largest integers.

Total: The sum of all the accepted integers.

Average: The sum of all the accepted integers divided by their count. This field is not necessarily an integer and should actually be treated and displayed as double.

If an integer is entered that is zero, negative, or not a multiple of 3, that integer is ignored, and an error message is displayed stating that "Invalid integer: not positive or not a multiple of 3." The user is then prompted to try again. Need this done in C++ please!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!