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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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 E:\EUNC_prog\assignments\assignment_4\submissions\Project2\x64\Debug\Project2.exe
Enter the amount of pepsi: 40
40
30
20
10
Enter the amount of pepsi: 50
50
40
30
20
10
Enter the amount of pepsi: 60
60
50
40
30
20
10
Enter the amount of pepsi: 70
70
60
50
40
30
20
10
Enter the amount of pepsi: 80
80
70
60
50
40
30
20
10
Enter the amount of pepsi: 90
90
80
70
60
50
40
30
20
10
Enter the amount of pepsi: 100
100
Enter the amount of pepsi: 200
200
Enter the amount of pepsi: 300
300
Enter the amount of pepsi: 400
400
Enter the amount of pepsi: 500
500
Enter the amount of pepsi: 600
600
Enter the amount of pepsi: 700
700
Enter the amount of pepsi: 800
800
Enter the amount of pepsi: 900
90
80
70
60
50
40
30
20
100
90
80
70
60
50
40
30
200
100
90
80
70
60
50
40
300
200
100
90
80
70
60
50
400
300
200
100
90
80
70
60
500
400
300
200
100
90
80
70
600
500
400
300
200
100
90
80
700
600
500
400
300
200
100
90
900
800
700
600
500
400
300
200
100
Enter the amount of pepsi: 1000
1000
Enter the amount of pepsi: 2000
2000
Enter the amount of pepsi: and SO 000000000000000000000ON
900
800
700
600
500
400
300
200
100
1000
900
800
700
600
500
400
300
200
Figure 3: Sample output
Transcribed Image Text:A E:\EUNC_prog\assignments\assignment_4\submissions\Project2\x64\Debug\Project2.exe Enter the amount of pepsi: 40 40 30 20 10 Enter the amount of pepsi: 50 50 40 30 20 10 Enter the amount of pepsi: 60 60 50 40 30 20 10 Enter the amount of pepsi: 70 70 60 50 40 30 20 10 Enter the amount of pepsi: 80 80 70 60 50 40 30 20 10 Enter the amount of pepsi: 90 90 80 70 60 50 40 30 20 10 Enter the amount of pepsi: 100 100 Enter the amount of pepsi: 200 200 Enter the amount of pepsi: 300 300 Enter the amount of pepsi: 400 400 Enter the amount of pepsi: 500 500 Enter the amount of pepsi: 600 600 Enter the amount of pepsi: 700 700 Enter the amount of pepsi: 800 800 Enter the amount of pepsi: 900 90 80 70 60 50 40 30 20 100 90 80 70 60 50 40 30 200 100 90 80 70 60 50 40 300 200 100 90 80 70 60 50 400 300 200 100 90 80 70 60 500 400 300 200 100 90 80 70 600 500 400 300 200 100 90 80 700 600 500 400 300 200 100 90 900 800 700 600 500 400 300 200 100 Enter the amount of pepsi: 1000 1000 Enter the amount of pepsi: 2000 2000 Enter the amount of pepsi: and SO 000000000000000000000ON 900 800 700 600 500 400 300 200 100 1000 900 800 700 600 500 400 300 200 Figure 3: Sample output
Fill
1)
Fill
Shift
2)
Fill
Shift
3)
Figure 1: self serving table with 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
Fill
Shift
Fill
Shift
Figure 2: The rotation mechanism
Transcribed Image Text:Fill 1) Fill Shift 2) Fill Shift 3) Figure 1: self serving table with 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 Fill Shift Fill Shift Figure 2: The rotation mechanism
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY