Link to home
Start Free TrialLog in
Avatar of lbay48
lbay48

asked on

New to VB

I have just started a course on VB and need some help calculkating produc cost = .95 and second product = .50 I will also need to figure taxes at 5,7,10%

I just cant seem to figure this out
Avatar of bistrica
bistrica

Dim product_cost
Dim second_product
Dim TAX_RATE
Dim tax_to_pay

product_cost = product_cost * 0.95
second_product= second_product * 0.5

TAX_RATE = 5 'or 7 or 10

tax_to_pay = product_cost * TAX_RATE / 100


Avatar of Dirk Haest
Declare your variables as a specific type, to avoid troubles

Dim product_cost, second_product, tax_to_pay as double
Dim TAX_RATE as integer

product_cost = product_cost * 0.95
second_product= second_product * 0.5

TAX_RATE = 5 'or 7 or 10

tax_to_pay = product_cost * TAX_RATE / 100

Avatar of lbay48

ASKER

for an extra 200 pts.

Ok, this is what should be happening.

Large = $.95
Regular = $.50

Using the menu titled Tax Rate;  there is a variable tax rate of 5,7,10 and tax free or 0 to choose from  once a rate is selected using the menu. I should be able to enter any number
And then hit the Calculate button and it should calculate number of large  + number of regular and depending on the rate calculate the price +Tax  in one text box.

Shipping charges should also be calculated at the same time but will fall under a different text box

Shipping cost is based on
Large weighs = 11oz
Regular weighs= 6 oz

Shipping is $1 per pound and $.10 per additional oz

Lastly is total and I have that figured.

Desperate please help!



Sounds like homework...
Start like this:

1) Designe GUI of the application. That is: create form, add menu on the from, add command button and anme it cmd Calculate, add text box(es) to enter value(s) and display result(s).

2) Each of this objects has Events. Selct events for them (On_Click) and add code to do what you need.

3) Code is mathematical calculation:
txtShippingCost = txtWeight * txtQuantity * TAX_RATE


In your posting you have described task, but was is the problem?
ASKER CERTIFIED SOLUTION
Avatar of Jeff Tennessen
Jeff Tennessen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lbay48

ASKER

Jeff,

Thanks for the help, the code is a little advance for me, but I was able to see wheer I made my mistakes and what I need to work on. I'm not sure what "mit" means but Im getting there. My main problem was that I was failing to give exact commands for each event.

LB
LB, "mit" is just the control prefix I use for "menu item." It has no special significance, and you can use whatever works best for you. Glad the solution was able to help you!

Jeff