QUESTION IMAGE
Question
name an error present in the following pseudocode. start declarations global num merchcost output \enter purchase total: \ input merchcost calculatesalestax() output \please pay \, (merchcost + salestax) stop calculatesalestax() declarations num salestax num taxrate = .08 salestax = taxrate * merchcost return a. the main program declares only global variables. b. the module attempts to use a variable that is out of scope. c. the main program attempts to use a variable that is out of scope. d. the module is never called by the main program.
The salesTax variable is declared and calculated within the calculateSalesTax() module. In the main program, when trying to use salesTax in the output statement output "Please pay ", (merchCost + salesTax), the variable salesTax is out - of - scope as it is a local variable to the calculateSalesTax() module and not properly passed back or declared globally in a way that the main program can access it.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
c. The main program attempts to use a variable that is out of scope.