// This progam 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
Button calcButton
Textbox usersEntry
Label result
screen1.setSize(200, 200)
calcButton.setText("Click to calculate 10% tax") calcButton.registerListener(calculateTax())
screen1.add(usersEntry)
stop
calculateTax()
Declarations
Label result
num RATE = 0.10
string answer
tax = usersEntry.getText() * RATE
answer = "The tax is " tax result.setText(answer)
screen1.add(result)
return
Are there anymore bugs? I'm kinda not understanding where the .getText comes from on here and think it might be a bug.
Question
Cray Zze
// This progam 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
Button calcButton
Textbox usersEntry
Label result
screen1.setSize(200, 200)
calcButton.setText("Click to calculate 10% tax")
calcButton.registerListener(calculateTax())
screen1.add(usersEntry)
stop
calculateTax()
Declarations
Label result
num RATE = 0.10
string answer
tax = usersEntry.getText() * RATE
answer = "The tax is " tax
result.setText(answer)
screen1.add(result)
return
Are there anymore bugs? I'm kinda not understanding where the .getText comes from on here and think it might be a bug.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts