I need the following pseudocode to be placed in the below hand trace chart pleas
ID: 3672272 • Letter: I
Question
I need the following pseudocode to be placed in the below hand trace chart please!
1 Module main ()
// Declare variables below
1.1 Declare Integer totalBottles = 0
1.2 Declare Integer todayBottles = 0
1.3 Declare string keepGoing = ‘y’
// Loop to run program again
1.4 While keepGoing == ‘y’
// Call functions
1.5 getBottles (totalBottles, todayBottles, counter)
1.6 calcPayout (totalPayout, totalBottles)
1.7 printInfo (totalBottles, totalPayout)
1.8 Display “Do you want to run the program again? (Enter y for yes).”
1.9 Input keepGoing
1.10 End While
1.11 End Module
In the pseudocode below, write the missing lines, including:
The missing parameter list
The missing condition (Hint: should run seven iterations)
The missing input variable
The add to the total
The increment statement for the counter
//getBottles module
Module getBottles(Integer totalBottles, Integer todayBottles, Integer counter)
1.5.2 Integer todaysBottles
1.5.3 Integer counter = 1
1.5.4 While _______________________________
1.5.5 Display “Enter number of bottles returned for the day:”
1.5.6 Input todayBottles
1.5.7 totalBottles = totalBottles + todayBottles
1.5.8 counter = counter + 1
1.5.9 End While
1.5.10 End Module
In the pseudocode below, write the missing lines, including:
The missing parameter list
The missing calculation
//getBottles module
1.6.1 Module calcPayout(totalPayout, totalBottles)
1.6.2 totalPayout = 0 //resets to 0 for multiple runs
1.6.3 totalBottles * .10
1.6.4 End Module
In the pseudocode below, write the missing lines, including:
The missing parameter list
The missing display statement
The missing display statement
//printInfo module
1.7.1 Module printInfo(totalBottles, totalPayout)
1.7.2 Print “ Your total number of bottles is “ +totalBottles
1.7.3 Print “Your payout is “ +totalPayout
1.7.4 End Module
c. PUT HAND TRACE CHART HERE [2 points] (Your Hand Trace Chart should include a column for each of the variables defined in the pseudo code and a row for each line of code. Include an additional column to show output that is displayed to the user. Enter the values 1 , 2, 3, 4, 5, 6, 7 for the bottles entered. Enter y to run the program again. Enter the values 10, 20, 30, 40, 50, 60, 70 for the bottles. Enter n to end the program.
Statement #
total
Bottles
total
Payout
keep
Going
counter
todays
Bottles
display
Statement #
total
Bottles
total
Payout
keep
Going
counter
todays
Bottles
display
Explanation / Answer
Statement #
total
Bottles
total
Payout
keep
Going
counter
todays
Bottles
display
1.5.6 and 1.5.8
2
1
1.5.6 and 1.5.8
3
2
1.5.6 and 1.5.8
4
3
1.5.6 and 1.5.8
5
4
1.5.6 and 1.5.8
6
5
1.5.6 and 1.5.8
7
6
1.5.6, 1.5.8, 1.5, 1.6, and 1.7
28
2.8000000000000003
8
7
Your total number of bottles is 28
Your payout is 2.8000000000000003
1.9
y
1.5.6 and 1.5.8
2
10
1.5.6 and 1.5.8
3
20
1.5.6 and 1.5.8
4
30
1.5.6 and 1.5.8
5
40
1.5.6 and 1.5.8
6
50
1.5.6 and 1.5.8
7
60
1.5.8, 1.5, 1.6, and 1.7
308
30.8
8
70
Your total number of bottles is 308
Your payout is 30.8
Statement #
total
Bottles
total
Payout
keep
Going
counter
todays
Bottles
display
1.5.6 and 1.5.8
2
1
1.5.6 and 1.5.8
3
2
1.5.6 and 1.5.8
4
3
1.5.6 and 1.5.8
5
4
1.5.6 and 1.5.8
6
5
1.5.6 and 1.5.8
7
6
1.5.6, 1.5.8, 1.5, 1.6, and 1.7
28
2.8000000000000003
8
7
Your total number of bottles is 28
Your payout is 2.8000000000000003
1.9
y
1.5.6 and 1.5.8
2
10
1.5.6 and 1.5.8
3
20
1.5.6 and 1.5.8
4
30
1.5.6 and 1.5.8
5
40
1.5.6 and 1.5.8
6
50
1.5.6 and 1.5.8
7
60
1.5.8, 1.5, 1.6, and 1.7
308
30.8
8
70
Your total number of bottles is 308
Your payout is 30.8
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.