Clearly Visual Basic, 3rd Edition Programming with... Clearly Visual Basic, 3rd
ID: 3833716 • Letter: C
Question
Clearly Visual Basic, 3rd Edition Programming with...
Clearly Visual Basic, 3rd Edition,Programming with Microsoft Visual Basic 2012
by Diane Zak
Year: 2013
Pages: 674
ISBN: 978-1285084107, 1285084101
376 INTERMEDIATE 8. In this exercise, you create an application for a company named Just Mats. The company sells three different types of mats: Standard ($159), I Love Gymnastics ($189), and Cheer Is Fun ($189). All of the mats are available in blue, red ($10 extra), and pink ($15 extra). The application should calculate the price of a mat.Explanation / Answer
Dim message, title, defaultValue As String
Dim myValue As Single
Dim price As Single
message = "Enter value 1 for Standard Mat, 2 for I Love Gymnastics Mat and 3 for Cheer Is Fun Mat"
title = "Choice of Mat"
defaultValue = "1" ' Set default value.
' Display message, title, and default value.
myValue = InputBox(message, title, defaultValue)
' Set the initial price according to the type of Mat chosen
If myValue Is 1 Then price = 159
If myValue Is 2 Then price = 189
If myValue Is 3 Then price = 189
message = "Enter value 1 for Blue color, 2 for Red (10$ extra) and 3 for Pink (15$ extra)"
title = "Choice of Color"
defaultValue = "1" ' Set default value.
' Display message, title, and default value.
myValue = InputBox(message, title, defaultValue)
If myValue Is 2 Then price = price + 10
If myValue Is 3 Then price = price + 15
MsgBox("The total price is " + Convert.ToString(price) + "$ only!") ' Display final price on computer screen
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.