Question: Write a program that implements the following functions: 1)Write a function named getProduct with no formal parameters that requests a collections of positive and negative

Write a program that implements the following functions:

1)Write a function named getProduct with no formal parameters that requests a collections of positive and negative integers from the user and multiplies only the positive integers. Loop exit should occur when three consecutive negative values are read. The product should be returned from the function.

2)Write a function named getStats that receives a single integer named n. The function requests n doubles from the user and then outputs the smallest number, largest number, and the average of all the numbers entered. The function does not return anything.

2)Write a main function that tests both functions.

Example Output:

Function 1:

Testing getProduct

Enter positive #: 2

Enter positive #: 4

Enter positive #: 8

Enter positive #: -1

Enter positive #: 2

Enter positive #: -1

Enter positive #: -2

Enter positive #: -3

Product of positive integers is 128

Function 2 : Enter n: 4

Testing getStats

#1: 2

#2: 3

#3: 4

#4: 1

Smallest: 1

Largest: 4

Average: 2.5

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!