Question: Your downloadable files for Chapter 1 2 include DEBUG 1 2 - 0 1 . txt , DEBUG 1 2 - 0 2 . txt

Your downloadable files for Chapter 12 include DEBUG12-01.txt, DEBUG12-02.txt, DEBUG12-03.txt, and DEBUG12-04.jpg. Each file starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Each file contains pseudocode or a flowchart that has mistakes. Find and correct all the bugs.
DEBUG12-01. txt
// This is a Label class.
// It defines a label that can appear on a GUI screen.
class Label
Declarations
private string text
private num horizontalPosition
private num verticalPosition
public void setText()
text = message
return
public void setPosition(x, y)
horizontalPosition = x
verticalPosition = x
return x
endClass
DEBUG12-02.txt
// This program creates a screen with a button.
// When the user clicks the button, a label displays "Hello".
start
Declarations
Screen screen1= new Screen()
Button helloButton = new Button()
Label helloLabel = new Label()
screen1.setSize(200,200)
helloButton.setText(Click to see a greeting)
helloButton.registerListener(greetingMethod())
helloLabel.setText("Hello")
screen1.add(helloLabel)
stop
greetingMethod()
return
DEBUG12-03.txt
// This program creates a screen with a textbox and a button.
// When the user clicks the button, a label displays the result
// which is 10% of the number in the textbox.
start
Declarations
Screen screen1= new Screen()
Button calcButton = new Screen()
Textbox usersEntry = new TextBox()
Label result
screen1.setSize(200,200)
calcButton.setText("Click to calculate 10% tax")
screen1.add(usersEntry)
screen1.add(button)
stop
calculateTax()
Declarations
Label result = new Label()
num tax
num RATE =0.10
string answer
tax = usersEntry.getText()* RATE
answer = "The tax is ", tax
result.setText()
screen1.add(result)
return
DEBUG12-04.jpg
// These storyboard sketches have been created for an interactive program that accepts customers'
drink orders and displays a price. The user makes choices and a price is calculated based on type and
size of drink and applicable tax. An object dictionary appears below the storyboard sketches. Correct
the bugs.
Regular
Diet
Your downloadable files for Chapter 1 2 include

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!