Could someone translate this to strucutred english/psedocode (i.e declare mailbo
ID: 3819337 • Letter: C
Question
Could someone translate this to strucutred english/psedocode (i.e declare mailbox, call procedure)
1.Public Class Form1
2. Private Sub btnDisplay_Click_1(sender As Object, e As EventArgs) Handles btnDisplay.Click
3. 'Declare the variables()
4. Dim bagels, cost As Double
5 Get the input of number of bagels
6 'Read the input from user
7 bagels = CDbl(InputBox("Enter the number of bagels ordered"))
8 'If the bagels less than half a dozen
9 'If (bagels <6) Then
10 'Multiply 75 cents per bagel
11 cost = bagels * 0.75
12 'If the bagels more than half a dozen
13 Else
14 'Multiply 60 cents per bagel
15 cost = bagels * 0.6
16 End If
17 'Display the total cost for bagels
18 txtDisplay.Text = "" & cost & "cents"
19 End Sub
20 Private Sub btnExit_Click(sender As Object, e As System.EventArgs) Handles btnExit.Click
21 End the Application
22 'Close the form
23 Me.Close()
24 End Sub
25End Class
Explanation / Answer
Create a class named Form1
Create a btnDisplay_Click_1() member function of class Form1
Declare varaibles bagles,cost as double
Read bagles
if bagles is less than half dozens (i.e <6) Then
set cost to bagles * 0.75
else if bagles is greater than half dozens (i.e >6) Then
set cost to bagles * 0.6
end if
Write cost cents
End sub
close the form1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.