Hi
I don't know if anyone can help me but i'm doing this program in school and i'm so confused.
It's supposed to upgrade the original cost by adding the upgrades then the discounts then VATCost,Delivery Cost etc
The thing that is wrong with it is that whenever I enter yes when it asks you to upgrade it doesn't add it to the original cost and when you get to the upgrades it only comes up with only discount1.
I'm working with Visual Basic 5.0 CCE
So here is my coding:
Private Sub cmdBegin_Click()
Dim HardDisk As Integer
Dim RAM As Integer
Dim Monitor As Integer
Dim Discount1 As Integer
Dim Discount2 As Integer
Dim DeliveryCost As Integer
Dim VATCost As Integer
Dim TotalCost As Integer
Dim TotalCost2 As Integer
Call Upgrades(HardDisk, RAM, Monitor)
Call CalculateDiscount(Discount1, Discount2)
Call Delivery(DeliveryCost)
Call CalculateVAT(VATCost)
Call calculatetotalcost(TotalCost, TotalCost2)
Call displaytotalcost(TotalCost, TotalCost2)
End Sub
Private Sub Upgrades(ByVal HardDisk As Integer, RAM As Integer, Monitor As Integer)
InputBox ("Do you want the 60gb HD")
If Upgrade = yes Then
TotalCost = 499 + 30
MsgBox ("You have chosen the 60gb HD")
End If
InputBox ("Do you want the 1gb RAM Upgrade")
If Upgrade = yes Then
TotalCost = 499 + 30 + 50
MsgBox ("You have chosen the 1gb Ram Upgrade")
End If
InputBox ("Do you want a 21 inch monitor")
If Upgrade = yes Then
TotalCost = 499 + 30 + 50 + 199
MsgBox ("You have chosen the 21 inch monitor upgrade")
End If
End Sub
Private Sub CalculateDiscount(ByVal Discount1 As Integer, Discount2 As Integer)
InputBox ("How many computers do you want")
If Discount1 >= 10 Or Discount1 <= 20 Then
TotalCost = 0.05 * 499 + 30 + 50 + 199
MsgBox ("You have chosen Discount1")
Else
If Discount2 >= 20 Or Discount2 <= 30 Then
TotalCost2 = 0.1 * 499 + 30 + 50 + 199
MsgBox ("You have chosen Discount2")
End If
End If
End Sub
Private Sub Delivery(ByVal DeliveryCost As Integer)
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50
End If
End Sub
Private Sub CalculateVAT(ByVal VATCost As Integer)
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50 * 0.175
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50 * 0.175
End If
End Sub
Private Sub calculatetotalcost(ByVal TotalCost As Integer, TotalCost2 As Integer)
'calculates the total cost of the computers
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50 * 0.175
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50 * 0.175
End If
End Sub
Private Sub displaystotalcost(ByVal TotalCost As Integer, TotalCost2 As Integer)
If Discount1 Then
txtTotalCost.Text = TotalCost
End If
Else
If Discount2 Then
txtTotalCost = TotalCost2
End If
End Sub
The form has a command button and a text box to display the message.
So i hope someone can help.
Thanks
Keir
I don't know if anyone can help me but i'm doing this program in school and i'm so confused.
It's supposed to upgrade the original cost by adding the upgrades then the discounts then VATCost,Delivery Cost etc
The thing that is wrong with it is that whenever I enter yes when it asks you to upgrade it doesn't add it to the original cost and when you get to the upgrades it only comes up with only discount1.
I'm working with Visual Basic 5.0 CCE
So here is my coding:
Private Sub cmdBegin_Click()
Dim HardDisk As Integer
Dim RAM As Integer
Dim Monitor As Integer
Dim Discount1 As Integer
Dim Discount2 As Integer
Dim DeliveryCost As Integer
Dim VATCost As Integer
Dim TotalCost As Integer
Dim TotalCost2 As Integer
Call Upgrades(HardDisk, RAM, Monitor)
Call CalculateDiscount(Discount1, Discount2)
Call Delivery(DeliveryCost)
Call CalculateVAT(VATCost)
Call calculatetotalcost(TotalCost, TotalCost2)
Call displaytotalcost(TotalCost, TotalCost2)
End Sub
Private Sub Upgrades(ByVal HardDisk As Integer, RAM As Integer, Monitor As Integer)
InputBox ("Do you want the 60gb HD")
If Upgrade = yes Then
TotalCost = 499 + 30
MsgBox ("You have chosen the 60gb HD")
End If
InputBox ("Do you want the 1gb RAM Upgrade")
If Upgrade = yes Then
TotalCost = 499 + 30 + 50
MsgBox ("You have chosen the 1gb Ram Upgrade")
End If
InputBox ("Do you want a 21 inch monitor")
If Upgrade = yes Then
TotalCost = 499 + 30 + 50 + 199
MsgBox ("You have chosen the 21 inch monitor upgrade")
End If
End Sub
Private Sub CalculateDiscount(ByVal Discount1 As Integer, Discount2 As Integer)
InputBox ("How many computers do you want")
If Discount1 >= 10 Or Discount1 <= 20 Then
TotalCost = 0.05 * 499 + 30 + 50 + 199
MsgBox ("You have chosen Discount1")
Else
If Discount2 >= 20 Or Discount2 <= 30 Then
TotalCost2 = 0.1 * 499 + 30 + 50 + 199
MsgBox ("You have chosen Discount2")
End If
End If
End Sub
Private Sub Delivery(ByVal DeliveryCost As Integer)
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50
End If
End Sub
Private Sub CalculateVAT(ByVal VATCost As Integer)
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50 * 0.175
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50 * 0.175
End If
End Sub
Private Sub calculatetotalcost(ByVal TotalCost As Integer, TotalCost2 As Integer)
'calculates the total cost of the computers
If Discount1 Then
TotalCost = 499 + 30 + 50 + 199 * 0.05 + 50 * 0.175
End If
If Discount2 Then
TotalCost2 = 499 + 30 + 50 + 199 * 0.1 + 50 * 0.175
End If
End Sub
Private Sub displaystotalcost(ByVal TotalCost As Integer, TotalCost2 As Integer)
If Discount1 Then
txtTotalCost.Text = TotalCost
End If
Else
If Discount2 Then
txtTotalCost = TotalCost2
End If
End Sub
The form has a command button and a text box to display the message.
So i hope someone can help.
Thanks
Keir