A total purchase of items totaling under $50, we charge $5 shipping.
A total purchase of items totaling $50 and over, there is no shipping charge.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Declare variables
Dim purchase, shipping, total As Double
purchase = CDbl(txtpurchase.text)
shipping = 5
'Calculate total
If purchase >= 50 Then
total = FormatCurrency(purchase)
ElseIf purchase < 50 Then
total = purchase + shipping
End If
'Display total
MessageBox.Show("Your total is: " & FormatCurrency(total), "Please Pay")
End Sub
End Class
2.) You are looking for something to control your heat in your apartment and you discover there is NOT an app for that. It's about time that someone created one. You decide that you are the one to do it. Here's what you want to do.
-You want to turn the heat on when the temp has dropped below 72
-You also want to turn the AC on when the temp gets above 76
Your app should display in a message box if the heat is on, the AC is on, or if the system is idle.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Declare variables
Dim temp As Double
temp = CDbl(txtpurchase.Text)
'Calculate total
If temp <= 72 Then
MessageBox.Show("The heat is on.", "Heat")
ElseIf temp > 72 And temp < 76 Then
MessageBox.Show("The system is idle", "Idle System")
ElseIf temp >= 76 Then
MessageBox.Show("The A/C is on.", "A/C")
End If
End Sub
End Class
3.) You are working on a clothing website where people can buy kids socks. It's really hard for the customers to know what size they should buy for what age. It would be a good idea for the customer to have a tool to input their child's age and have the website suggest a size for them. Write a tool where you can set the age as a variable and have it suggest on of the sizes below:
a.0-2 yrs -XS
b.3-4 yrs -S
c.5-8 yrs -M
d.9-12 yrs -L
e.13+ yrs -XL
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Declare variables
Dim age As Double
age = CDbl(txtpurchase.Text)
'Calculate total
If age <= 2 Then
MessageBox.Show("Your child's size is XS.", "XS")
ElseIf age >= 3 And age <= 4 Then
MessageBox.Show("Your child's size is Small", "Small")
ElseIf age >= 5 And age <= 8 Then
MessageBox.Show("Your child's size is Medium", "Medium")
ElseIf age >= 9 And age <= 12 Then
MessageBox.Show("Your child's size is Large", "Large")
ElseIf age >= 13 Then
MessageBox.Show("Your child's size is X-Large.", "X-Large")
End If
End Sub
End Class
No comments:
Post a Comment