Given the code below, write a method call for the method (assume that each parameter is a String).  Then determine that method’s output given the arguments that you pass. METHOD trickOrTreat (parameters:  candy) BEGIN CREATE treat ← 26 SWITCH candy                                 CASE “Tootsie Roll”:  treat ++                                 CASE “Candy Corn”:  treat += 2                                 BREAK

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 10RQ
icon
Related questions
Question

Given the code below, write a method call for the method (assume that each parameter is a String).  Then determine that method’s output given the arguments that you pass.

METHOD trickOrTreat (parameters:  candy)

BEGIN

CREATE treat ← 26

SWITCH candy

                                CASE “Tootsie Roll”:  treat ++

                                CASE “Candy Corn”:  treat += 2

                                BREAK

                                CASE “Twizzlers”:  treat -= 2

                                CASE “Dots”: treat --

                                CASE “Kit Kat”: treat *= 2             

                END SWITCH

                                RETURN treat

END METHOD

Method Call

 

 

 

Exact Output

 

 

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage