Translate this into the hand trace chart below. More information listed below Mo
ID: 3664438 • Letter: T
Question
Translate this into the hand trace chart below. More information listed below
Module main ()
//Declare local variables
1 Declare Real totalSales
2 Declare Real countyTax
3 Declare Real stateTax
4 Declare Real totalTax
//Function calls
5 Call inputData(totalSales)
6 Call calcCounty(totalSales, countyTax)
7 Call calcState(totalSales, stateTax)
8 Call calcTotal(countyTax, stateTax, totalTax)
9 Call printTax(countyTax, stateTax, totalTax)
End Module
//this module takes in the required user input from the user.
5.1 Module inputData(Real Ref totalSales)
5.1a Display “Enter the total sales for the month.”
5.1b Input totalSales
5.2 End Module
//this module calculates county tax.
//totalSales can be a value parameter because it is not changed in the module.
//countyTax must be a reference parameter because it is changed in the module
6.1 Module calcCounty(Real totalSales, Real Ref countyTax)
6.1a countyTax = totalSales * .02
6.2 End Module
//this module calculates state tax …
7.1 Module calcState(Real totalSales, real Ref stateTax)
7.1a stateTax = totalSales * .04
7.2 End Module
//this module calculates total tax …
8.1 Module calcTotal(Real Ref totalTax, Real stateTax, Real countyTax)
8.1a totalTax = countyTax + stateTax
8.2 End Module
//this module prints the total, county, and state tax …
9.1 Module printData(Real countyTax, Real stateTax, Real Ref totalTax)
9.1a Display “The county tax is “, countyTax
9.1b Display “the state tax is “, stateTax
9.1c Display “The total tax is “, totalTax
9.2 End Module
PUT HAND TRACE CHART HERE [3 points] (Hand Trace your pseudo code solution in step b above. The pseudocode has already been numbered for you. Using the hand trace chart below, add your variable names to the columns at the top. Manually work through your pseudo code solution above, one line at a time, identify the values in each of the noted variables after a line completes. If a variable does not yet exist, leave blank. If a variable exists, but does not contain a value, enter UD for undefined. Remember, when a module is called, the program jumps to the module to execute it’s statements. When the module finishes the program returned to where the module was called and continues from that point forwards.
Enter the value $27,097 for the total sales.
Statement #
1
2
3
4
5
5.1
5.1a
5.1b
5.2
6
6.1
6.1a
6.2
7
7.1
7.1a
7.2
8
8.1
8.1a
8.2
9
9.1
9.1a
9.1b
9.1c
9.2
Statement #
1
2
3
4
5
5.1
5.1a
5.1b
5.2
6
6.1
6.1a
6.2
7
7.1
7.1a
7.2
8
8.1
8.1a
8.2
9
9.1
9.1a
9.1b
9.1c
9.2
Explanation / Answer
Hand trace of code
Statement #
1
totalSales
totalSales=0
2
countyTa
countyTax=0
3
stateTax
stateTax=0
4
totalTax
totalTax=0
5
inputData(totalSales)
5.1
inputData(ref 0)
5.1a
Enter the total sales for the month.
5.1b
totalSales=27097
5.2
End of inputData()
6
calcCounty(totalSales, countyTax)
totalSales=27097
countyTax=0
6.1
calcCounty(totalSales, ref countyTax=0)
totalSales=27097
countyTax=0
6.1a
countyTax = 27097 * .02
Calculate countyTax= 5419.4
totalSales=27097
countyTax=5419.4
6.2
End of calcCounty( ) method
7
calcState(totalSales, stateTax)
totalSales=27097
stateTax=0
7.1
calcState(totalSales, ref stateTax=0)
totalSales=27097
stateTax=0
7.1a
stateTax = 27097 * .04
Calculate stateTax= 1083.88
totalSales=27097
stateTax= 1083.88
7.2
End of calcState ()
8
calcTotal(countySales, stateTax, totalTax)
countySales=5419.4
salesTax=1083.88
totalTax=0
8.1
calcTotal(countySales=5419.4, stateTax=1083.88, totalTax=0)
countySales=5419.4
salesTax=1083.88
totalTax=0
8.1a
totalTax = 5419.3 + 1083.88
totalTax=6503.18
countySales=5419.4
salesTax=1083.88
totalTax=6503.18
8.2
End of calcTotal method
9
printTax(countyTax, stateTax, totalTax)
totalTax=6503.18
salesTax=1083.88
countySales=5419.4
9.1
printData(Real countyTax, Real stateTax, Real Ref totalTax)
totalTax=6503.18
salesTax=1083.88
countySales=5419.4
9.1a
The county tax is 5419.4
9.1b
the state tax is 1083.88
9.1c
The total tax is 6503.18
9.2
End of Module
Statement #
1
totalSales
totalSales=0
2
countyTa
countyTax=0
3
stateTax
stateTax=0
4
totalTax
totalTax=0
5
inputData(totalSales)
5.1
inputData(ref 0)
5.1a
Enter the total sales for the month.
5.1b
totalSales=27097
5.2
End of inputData()
6
calcCounty(totalSales, countyTax)
totalSales=27097
countyTax=0
6.1
calcCounty(totalSales, ref countyTax=0)
totalSales=27097
countyTax=0
6.1a
countyTax = 27097 * .02
Calculate countyTax= 5419.4
totalSales=27097
countyTax=5419.4
6.2
End of calcCounty( ) method
7
calcState(totalSales, stateTax)
totalSales=27097
stateTax=0
7.1
calcState(totalSales, ref stateTax=0)
totalSales=27097
stateTax=0
7.1a
stateTax = 27097 * .04
Calculate stateTax= 1083.88
totalSales=27097
stateTax= 1083.88
7.2
End of calcState ()
8
calcTotal(countySales, stateTax, totalTax)
countySales=5419.4
salesTax=1083.88
totalTax=0
8.1
calcTotal(countySales=5419.4, stateTax=1083.88, totalTax=0)
countySales=5419.4
salesTax=1083.88
totalTax=0
8.1a
totalTax = 5419.3 + 1083.88
totalTax=6503.18
countySales=5419.4
salesTax=1083.88
totalTax=6503.18
8.2
End of calcTotal method
9
printTax(countyTax, stateTax, totalTax)
totalTax=6503.18
salesTax=1083.88
countySales=5419.4
9.1
printData(Real countyTax, Real stateTax, Real Ref totalTax)
totalTax=6503.18
salesTax=1083.88
countySales=5419.4
9.1a
The county tax is 5419.4
9.1b
the state tax is 1083.88
9.1c
The total tax is 6503.18
9.2
End of Module
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.