A self-service table is equipped with ten glass cups, a Pepsi filling machine, and a shifting mechanism. Part 1: 1) Regarding figure 1, the table fills the first cup. 2) After filling the first cup, the shifting mechanism shifts the filled cup to the right and fills the next cup, and so on. 3) Create the table's structure using arrays and functions. 4) Write a function called void _shift(int arr[], int size); to handle the shifting. 5) Write a function called void_fill(int arr[], int size, int pepsi); that always fills the first cup. 6) In the main function, prompt the user to enter the amount of Pepsi to fill the cup. Then construct the shifting mechanism Part 2: 1) When all of the cups have been filled, they will be rotated back to the beginning, check figure 2. 2) From now on, the table will rotate the last cup to the left and shift the first cup to the right. 3) The table will perform the last step until the user inserts 0 Part 3: 1) Create a function named void _sum(int amount , int *sum); that calculates the amount of pepsiserved at that day. 2) Display the total amount after finishing serving ( the user press 0
A self-service table is equipped with ten glass cups, a Pepsi filling
machine, and a shifting
Part 1:
1) Regarding figure 1, the table fills the first cup.
2) After filling the first cup, the shifting mechanism shifts the filled cup
to the right and fills the next cup, and so on.
3) Create the table's structure using arrays and functions.
4) Write a function called void _shift(int arr[], int size); to handle the shifting.
5) Write a function called void_fill(int arr[], int size, int pepsi); that always fills
the first cup.
6) In the main function, prompt the user to enter the amount of Pepsi to
fill the cup. Then construct the shifting mechanism
Part 2:
1) When all of the cups have been filled, they will be rotated back to the
beginning, check figure 2.
2) From now on, the table will rotate the last cup to the left and shift the
first cup to the right.
3) The table will perform the last step until the user inserts 0
Part 3:
1) Create a function named void _sum(int amount , int *sum); that calculates
the amount of pepsiserved at that day.
2) Display the total amount after finishing serving ( the user press 0
Step by step
Solved in 4 steps with 5 images