SlideShare a Scribd company logo
1 of 5
1. Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
‘Triple a number
Dim num As Double = 5
lstOutput.Items.Add(Triple(num))
lstOutput.Items.Add (num)
End Sub
Function Triple(ByVal x As Double) As Double
Dim num As Double = 3
Return num * x
End Function
2. Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim states, senators As Double
States = 50
Senators = 2
Senate(states * senators)
End Sub
Sub Senate (ByVal num as Double)
txtBox.Text = “the number of U.S. Senators is “ & num
End Sub
3. Find the errors.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word As String, number As Double
word = “seven”
number = 7
Display (word, number)
End Sub
Sub Display(ByVal num As Double, ByVal term As String)
textOutput.Text = num & “ “ & term
End Sub
4. Rewrite the program so input, processing, and output are each
performed by calls to Sub procedures.
Private Sub btnCompute_Click(...) Handles btnCompute.Click
‘Information about trees
Dim num As Integer = 7
Tree = “redwood”
ht = 362
lstBox.Items.Add(“The tallest “ & tree & “ tree in the U. S, is
“ & ht & & “ feet.”)
tree = “pine”
ht = 223
lstBox.Items.Add(“The tallest “ & tree & “ tree in the U. S. is
“ & ht & “ feet.”)
End Sub
5. Determine the output displayed when the button is clicked.
Private Sub btnDetermine_Click(...) Handles
btnDetermine.Click
Dim word As String = “”
Dim num As Integer
GetFacts(word, num)
txtOutput.text = “The first “ & num & “ letters of “ & word &
“ are “ & BegOfWord(word, num) & “.”
End Sub
Sub GetFacts(ByRef w As String, ByRef num As Integer)
w = InputBox(“enter a word: “)
n = CInt(InputBox(“Enter a number less than the length of
the word: “))
End Sub
Function BefOfWiord(ByVal word As String, ByVal num As
Integer) As String
Return word.Substring(0, num)
End Function
(Assume the two responses are Education and 3.)
6. Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim price, markdown, salesTax, finalCost as Double
InputData(price, finalCost)
finalCost = CostOfItem(price, markdown, salesTax)
DisplayOutput(price, finalCost)
End Sub
Sub InputData (ByRef price As Double, ByRef markdown As
Double, ByRef salesTax As Double)
Price = CDbl(InputBox(“Price of item: “)
Markdown = CDbl (InputBox(“Percentage discount: “))
salesTax = CDbl(InputBox(“Percentage state sales tax: “))
End Sub
Function CostOfItem(ByVal pr As Double, ByVal md As
Double, ByVal st As Double) As Double
Dim reducedPrice, cost As Double
reducedPrice = pr – ((md/100) * pr)
cost = reducedPrice + ((st / 100) * reducedPrice)
Return cost
End Function
(Assume the three responses are 125, 20, and 6)
7. Identify the errors.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word As String
word = InputBox("What is your favorite word?")
txtOutput.Text = "When the word is written twice, " & _
Twice(word) & " letters are used."
End Sub
Function Twice(ByVal w As String) As Integer
'Compute twice the length of a string
Dim len As Integer
Return len = 2 * w.Length
End Function
Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim num As Double = 0
Dim max As Double = -1
Dim prompt As String = “ Enter a nonnegative number. “ &
Enter -1 to terminate entering numbers.”
Num = CDbl(Input Box(prompt))
Do While num >= 0
If num > max Then
Max = num
End If
Num = CDbl(InputBox(prompt))
Loop
If max <> -1 Then
MessageBox.Show(“Maximum number: “ & max)
Else
MessageBox.Show(“No numbers were entered.”)
End If
Assu;me that the responses are 4, 7, 3, and -1)
2. Replace each phrase containing "Until" with an equivalent
phrase containing "While", and vice versa. For instance, the
phrase (Until sum = 100) would be replaced by (While sum <>
100).
While (ans = "Y") And (n < 7)
3. Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word As String = “courage”
Dim letter As String = “”
Dim numVowels As Integer = 0
For i As Integer = 0 To word.length – 1
Letter = word.Substring(I, 1)
If IsVowel (letter) Then
numVowels += 1
End If
Next
txtBox.Text = CStr(numVowels)
End Sub
Function IsVowel(ByVal letter As String) As Boolean
Letter = letter.ToUpper
If (letter = “A” Or (letter = “E”) Or (letter = “I”) Or (letter =
“O”) Or (letter = “U”) Then
Return True
Else
Return False
End If
End Function

More Related Content

Similar to 1. Determine the output displayed when the button is clicked.P.docx

Programas Gambas
Programas GambasProgramas Gambas
Programas GambasRZYMJ
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Programas Gambas
Programas GambasProgramas Gambas
Programas GambasRZYMJ
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambasguestdd103d
 
ejemplos gambas
ejemplos gambasejemplos gambas
ejemplos gambaseduann
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informaticamiguel camelo
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subirguest9da3a3
 
Ejemplo En Gamabas
Ejemplo En GamabasEjemplo En Gamabas
Ejemplo En Gamabaseduann
 
Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008atsumagaysay
 
Latihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganLatihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganNurul Arhaiyyu
 
Reservasi hotel
Reservasi hotelReservasi hotel
Reservasi hoteldian pw
 
Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008atsumagaysay
 

Similar to 1. Determine the output displayed when the button is clicked.P.docx (20)

Vb file
Vb fileVb file
Vb file
 
Correction s+ rie_vb
Correction s+ rie_vbCorrection s+ rie_vb
Correction s+ rie_vb
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Manual De Gambas
Manual De GambasManual De Gambas
Manual De Gambas
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Programas Gambas
Programas GambasProgramas Gambas
Programas Gambas
 
Proyecto Blob
Proyecto BlobProyecto Blob
Proyecto Blob
 
ejemplos gambas
ejemplos gambasejemplos gambas
ejemplos gambas
 
ملخص البرمجة المرئية - الوحدة الرابعة
ملخص البرمجة المرئية - الوحدة الرابعةملخص البرمجة المرئية - الوحدة الرابعة
ملخص البرمجة المرئية - الوحدة الرابعة
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informatica
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Trabajo Para Subir
Trabajo Para SubirTrabajo Para Subir
Trabajo Para Subir
 
Ejemplo En Gamabas
Ejemplo En GamabasEjemplo En Gamabas
Ejemplo En Gamabas
 
Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008
 
Latihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/PerulanganLatihan visual basic 2010/Looping/Perulangan
Latihan visual basic 2010/Looping/Perulangan
 
Vb.net programs
Vb.net programsVb.net programs
Vb.net programs
 
Reservasi hotel
Reservasi hotelReservasi hotel
Reservasi hotel
 
Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008
 

More from jackiewalcutt

briefly summarize how the Electoral College works. Explain some of t.docx
briefly summarize how the Electoral College works. Explain some of t.docxbriefly summarize how the Electoral College works. Explain some of t.docx
briefly summarize how the Electoral College works. Explain some of t.docxjackiewalcutt
 
Briefly summarize and analyze two primary sources, identifying their.docx
Briefly summarize and analyze two primary sources, identifying their.docxBriefly summarize and analyze two primary sources, identifying their.docx
Briefly summarize and analyze two primary sources, identifying their.docxjackiewalcutt
 
Briefly respond to the following questions. Use facts and examples t.docx
Briefly respond to the following questions. Use facts and examples t.docxBriefly respond to the following questions. Use facts and examples t.docx
Briefly respond to the following questions. Use facts and examples t.docxjackiewalcutt
 
Briefly in your own words describe the distinction between explicit .docx
Briefly in your own words describe the distinction between explicit .docxBriefly in your own words describe the distinction between explicit .docx
Briefly in your own words describe the distinction between explicit .docxjackiewalcutt
 
Briefly explain   Victoria Australia Covid19 update and impact.docx
Briefly explain   Victoria Australia Covid19 update and impact.docxBriefly explain   Victoria Australia Covid19 update and impact.docx
Briefly explain   Victoria Australia Covid19 update and impact.docxjackiewalcutt
 
Briefly introduce the détente policies of the early 1970s, and des.docx
Briefly introduce the détente policies of the early 1970s, and des.docxBriefly introduce the détente policies of the early 1970s, and des.docx
Briefly introduce the détente policies of the early 1970s, and des.docxjackiewalcutt
 
Briefly explain the role of information systems in an organization.docx
Briefly explain the role of information systems in an organization.docxBriefly explain the role of information systems in an organization.docx
Briefly explain the role of information systems in an organization.docxjackiewalcutt
 
briefly describe, in 2-3 pages, the problemissue and the proble.docx
briefly describe, in 2-3 pages, the problemissue and the proble.docxbriefly describe, in 2-3 pages, the problemissue and the proble.docx
briefly describe, in 2-3 pages, the problemissue and the proble.docxjackiewalcutt
 
Briefly explain the mission of the OSH Act. What is the rationale be.docx
Briefly explain the mission of the OSH Act. What is the rationale be.docxBriefly explain the mission of the OSH Act. What is the rationale be.docx
Briefly explain the mission of the OSH Act. What is the rationale be.docxjackiewalcutt
 
Briefly discuss the various organizational approaches to managing .docx
Briefly discuss the various organizational approaches to managing .docxBriefly discuss the various organizational approaches to managing .docx
Briefly discuss the various organizational approaches to managing .docxjackiewalcutt
 
Briefly explain the identified security issues during Risk Assessmen.docx
Briefly explain the identified security issues during Risk Assessmen.docxBriefly explain the identified security issues during Risk Assessmen.docx
Briefly explain the identified security issues during Risk Assessmen.docxjackiewalcutt
 
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docx
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docxBriefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docx
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docxjackiewalcutt
 
Briefly describe what a monopoly is and give an example using the ch.docx
Briefly describe what a monopoly is and give an example using the ch.docxBriefly describe what a monopoly is and give an example using the ch.docx
Briefly describe what a monopoly is and give an example using the ch.docxjackiewalcutt
 
Briefly describe the spread of industry throughout Europe and into.docx
Briefly describe the spread of industry throughout Europe and into.docxBriefly describe the spread of industry throughout Europe and into.docx
Briefly describe the spread of industry throughout Europe and into.docxjackiewalcutt
 
Briefly describe the path of food through the digestive system and e.docx
Briefly describe the path of food through the digestive system and e.docxBriefly describe the path of food through the digestive system and e.docx
Briefly describe the path of food through the digestive system and e.docxjackiewalcutt
 
Briefly describe the different parenting styles discussed in this we.docx
Briefly describe the different parenting styles discussed in this we.docxBriefly describe the different parenting styles discussed in this we.docx
Briefly describe the different parenting styles discussed in this we.docxjackiewalcutt
 
Briefly describe how the BIOS boots or starts the computer and.docx
Briefly describe how the BIOS boots or starts the computer and.docxBriefly describe how the BIOS boots or starts the computer and.docx
Briefly describe how the BIOS boots or starts the computer and.docxjackiewalcutt
 
Briefly describe how to deploy a Continuous Improvement effort.W.docx
Briefly describe how to deploy a Continuous Improvement effort.W.docxBriefly describe how to deploy a Continuous Improvement effort.W.docx
Briefly describe how to deploy a Continuous Improvement effort.W.docxjackiewalcutt
 
briefly define democracy and evaluate in detail THREE of.docx
briefly define democracy and evaluate in detail THREE of.docxbriefly define democracy and evaluate in detail THREE of.docx
briefly define democracy and evaluate in detail THREE of.docxjackiewalcutt
 
Briefly define, listcontrast, identify the significance of, or .docx
Briefly define, listcontrast, identify the significance of, or .docxBriefly define, listcontrast, identify the significance of, or .docx
Briefly define, listcontrast, identify the significance of, or .docxjackiewalcutt
 

More from jackiewalcutt (20)

briefly summarize how the Electoral College works. Explain some of t.docx
briefly summarize how the Electoral College works. Explain some of t.docxbriefly summarize how the Electoral College works. Explain some of t.docx
briefly summarize how the Electoral College works. Explain some of t.docx
 
Briefly summarize and analyze two primary sources, identifying their.docx
Briefly summarize and analyze two primary sources, identifying their.docxBriefly summarize and analyze two primary sources, identifying their.docx
Briefly summarize and analyze two primary sources, identifying their.docx
 
Briefly respond to the following questions. Use facts and examples t.docx
Briefly respond to the following questions. Use facts and examples t.docxBriefly respond to the following questions. Use facts and examples t.docx
Briefly respond to the following questions. Use facts and examples t.docx
 
Briefly in your own words describe the distinction between explicit .docx
Briefly in your own words describe the distinction between explicit .docxBriefly in your own words describe the distinction between explicit .docx
Briefly in your own words describe the distinction between explicit .docx
 
Briefly explain   Victoria Australia Covid19 update and impact.docx
Briefly explain   Victoria Australia Covid19 update and impact.docxBriefly explain   Victoria Australia Covid19 update and impact.docx
Briefly explain   Victoria Australia Covid19 update and impact.docx
 
Briefly introduce the détente policies of the early 1970s, and des.docx
Briefly introduce the détente policies of the early 1970s, and des.docxBriefly introduce the détente policies of the early 1970s, and des.docx
Briefly introduce the détente policies of the early 1970s, and des.docx
 
Briefly explain the role of information systems in an organization.docx
Briefly explain the role of information systems in an organization.docxBriefly explain the role of information systems in an organization.docx
Briefly explain the role of information systems in an organization.docx
 
briefly describe, in 2-3 pages, the problemissue and the proble.docx
briefly describe, in 2-3 pages, the problemissue and the proble.docxbriefly describe, in 2-3 pages, the problemissue and the proble.docx
briefly describe, in 2-3 pages, the problemissue and the proble.docx
 
Briefly explain the mission of the OSH Act. What is the rationale be.docx
Briefly explain the mission of the OSH Act. What is the rationale be.docxBriefly explain the mission of the OSH Act. What is the rationale be.docx
Briefly explain the mission of the OSH Act. What is the rationale be.docx
 
Briefly discuss the various organizational approaches to managing .docx
Briefly discuss the various organizational approaches to managing .docxBriefly discuss the various organizational approaches to managing .docx
Briefly discuss the various organizational approaches to managing .docx
 
Briefly explain the identified security issues during Risk Assessmen.docx
Briefly explain the identified security issues during Risk Assessmen.docxBriefly explain the identified security issues during Risk Assessmen.docx
Briefly explain the identified security issues during Risk Assessmen.docx
 
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docx
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docxBriefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docx
Briefly discuss some KSAs for Fighting Cybercrime and submit in a wo.docx
 
Briefly describe what a monopoly is and give an example using the ch.docx
Briefly describe what a monopoly is and give an example using the ch.docxBriefly describe what a monopoly is and give an example using the ch.docx
Briefly describe what a monopoly is and give an example using the ch.docx
 
Briefly describe the spread of industry throughout Europe and into.docx
Briefly describe the spread of industry throughout Europe and into.docxBriefly describe the spread of industry throughout Europe and into.docx
Briefly describe the spread of industry throughout Europe and into.docx
 
Briefly describe the path of food through the digestive system and e.docx
Briefly describe the path of food through the digestive system and e.docxBriefly describe the path of food through the digestive system and e.docx
Briefly describe the path of food through the digestive system and e.docx
 
Briefly describe the different parenting styles discussed in this we.docx
Briefly describe the different parenting styles discussed in this we.docxBriefly describe the different parenting styles discussed in this we.docx
Briefly describe the different parenting styles discussed in this we.docx
 
Briefly describe how the BIOS boots or starts the computer and.docx
Briefly describe how the BIOS boots or starts the computer and.docxBriefly describe how the BIOS boots or starts the computer and.docx
Briefly describe how the BIOS boots or starts the computer and.docx
 
Briefly describe how to deploy a Continuous Improvement effort.W.docx
Briefly describe how to deploy a Continuous Improvement effort.W.docxBriefly describe how to deploy a Continuous Improvement effort.W.docx
Briefly describe how to deploy a Continuous Improvement effort.W.docx
 
briefly define democracy and evaluate in detail THREE of.docx
briefly define democracy and evaluate in detail THREE of.docxbriefly define democracy and evaluate in detail THREE of.docx
briefly define democracy and evaluate in detail THREE of.docx
 
Briefly define, listcontrast, identify the significance of, or .docx
Briefly define, listcontrast, identify the significance of, or .docxBriefly define, listcontrast, identify the significance of, or .docx
Briefly define, listcontrast, identify the significance of, or .docx
 

Recently uploaded

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 

Recently uploaded (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 

1. Determine the output displayed when the button is clicked.P.docx

  • 1. 1. Determine the output displayed when the button is clicked. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click ‘Triple a number Dim num As Double = 5 lstOutput.Items.Add(Triple(num)) lstOutput.Items.Add (num) End Sub Function Triple(ByVal x As Double) As Double Dim num As Double = 3 Return num * x End Function 2. Determine the output displayed when the button is clicked. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim states, senators As Double States = 50 Senators = 2 Senate(states * senators) End Sub Sub Senate (ByVal num as Double) txtBox.Text = “the number of U.S. Senators is “ & num End Sub 3. Find the errors. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim word As String, number As Double word = “seven” number = 7 Display (word, number) End Sub Sub Display(ByVal num As Double, ByVal term As String)
  • 2. textOutput.Text = num & “ “ & term End Sub 4. Rewrite the program so input, processing, and output are each performed by calls to Sub procedures. Private Sub btnCompute_Click(...) Handles btnCompute.Click ‘Information about trees Dim num As Integer = 7 Tree = “redwood” ht = 362 lstBox.Items.Add(“The tallest “ & tree & “ tree in the U. S, is “ & ht & & “ feet.”) tree = “pine” ht = 223 lstBox.Items.Add(“The tallest “ & tree & “ tree in the U. S. is “ & ht & “ feet.”) End Sub 5. Determine the output displayed when the button is clicked. Private Sub btnDetermine_Click(...) Handles btnDetermine.Click Dim word As String = “” Dim num As Integer GetFacts(word, num) txtOutput.text = “The first “ & num & “ letters of “ & word & “ are “ & BegOfWord(word, num) & “.” End Sub Sub GetFacts(ByRef w As String, ByRef num As Integer) w = InputBox(“enter a word: “) n = CInt(InputBox(“Enter a number less than the length of the word: “)) End Sub Function BefOfWiord(ByVal word As String, ByVal num As Integer) As String
  • 3. Return word.Substring(0, num) End Function (Assume the two responses are Education and 3.) 6. Determine the output displayed when the button is clicked. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim price, markdown, salesTax, finalCost as Double InputData(price, finalCost) finalCost = CostOfItem(price, markdown, salesTax) DisplayOutput(price, finalCost) End Sub Sub InputData (ByRef price As Double, ByRef markdown As Double, ByRef salesTax As Double) Price = CDbl(InputBox(“Price of item: “) Markdown = CDbl (InputBox(“Percentage discount: “)) salesTax = CDbl(InputBox(“Percentage state sales tax: “)) End Sub Function CostOfItem(ByVal pr As Double, ByVal md As Double, ByVal st As Double) As Double Dim reducedPrice, cost As Double reducedPrice = pr – ((md/100) * pr) cost = reducedPrice + ((st / 100) * reducedPrice) Return cost End Function (Assume the three responses are 125, 20, and 6) 7. Identify the errors. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim word As String word = InputBox("What is your favorite word?") txtOutput.Text = "When the word is written twice, " & _ Twice(word) & " letters are used." End Sub Function Twice(ByVal w As String) As Integer
  • 4. 'Compute twice the length of a string Dim len As Integer Return len = 2 * w.Length End Function Determine the output displayed when the button is clicked. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim num As Double = 0 Dim max As Double = -1 Dim prompt As String = “ Enter a nonnegative number. “ & Enter -1 to terminate entering numbers.” Num = CDbl(Input Box(prompt)) Do While num >= 0 If num > max Then Max = num End If Num = CDbl(InputBox(prompt)) Loop If max <> -1 Then MessageBox.Show(“Maximum number: “ & max) Else MessageBox.Show(“No numbers were entered.”) End If Assu;me that the responses are 4, 7, 3, and -1) 2. Replace each phrase containing "Until" with an equivalent phrase containing "While", and vice versa. For instance, the phrase (Until sum = 100) would be replaced by (While sum <> 100). While (ans = "Y") And (n < 7) 3. Determine the output displayed when the button is clicked.
  • 5. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim word As String = “courage” Dim letter As String = “” Dim numVowels As Integer = 0 For i As Integer = 0 To word.length – 1 Letter = word.Substring(I, 1) If IsVowel (letter) Then numVowels += 1 End If Next txtBox.Text = CStr(numVowels) End Sub Function IsVowel(ByVal letter As String) As Boolean Letter = letter.ToUpper If (letter = “A” Or (letter = “E”) Or (letter = “I”) Or (letter = “O”) Or (letter = “U”) Then Return True Else Return False End If End Function