Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There is a machine dispensing marbles and I have pouches to fill with those marb

ID: 3543958 • Letter: T

Question

There is a machine dispensing marbles and I have pouches to fill with those marbles. The ideal amount of marbles I would want in each pouch would be 8, but the machine dispenses marbles in various amounts so that I may not always get a pouch with the perfect amount of marbles. As long as the pouch has less than 8 marbles, I will continue to fill it, but if I get a number greater than or equal to 8 after filling it more, I will simply move on to the next pouch.

If, for each pouch-filling experiment, there is a number of times I can press the button that dispenses the marbles, I would like to know about the following three cases : (1) If I fill a pouch with a perfect amount, (2) If I fill a pouch with too many marbles, and (3) If I fill a pouch with not enough marbles.  Here is a user input and output example:


Input:


How many experiments are you running?

2


How many times will the machine dispense marbles during each experiment? (Enter a value 1 - 50)

4


How many marbles are dispensed after each press of the button during experiment 1? (Enter a value 2-11)

3

5

10

7


How many marbles are dispensed after each press of the button during experiment 2? (Enter a value 2-11)

8

4

4

5


Output:

Experiment #1:

                      Pouch #1: The amount of marbles is just right!

                      Pouch #2: There are 3 extra marbles in the pouch.

                      Pouch #3: You would need 1 more marble to fill the pouch.

Experiment #2:

                      Pouch #1: The amount of marbles is just right!

                      Pouch #2: The amount of marbles is just right!

                      Pouch #3: You would need 3 more marbles to fill the pouch.        


Please help with this code in C! Thank you very much!               

Explanation / Answer

Answer has been posted at http://pastebin.com/sWcrivhT.

Please reply if you have any doubts.


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote