I’m using the book "programming in visual basic 2008". i can’t for the life of me figure out what to do here. i’m in chapter 4. the instructions read:
design and code a project to calculate the amount due for rentals. movies may be in vhs format or dvd format. videotapes rent for .80 each and DVDs rent for .50. new releases are for dvd and for vhs.
on the form include a text box to input the movie title and radio buttons to indicate whether the movie is in dvd or vhs format. use one check box to indicate whether the person is a member; members receive a 10 percent discount. another check box indicates a new release.
use the buttons for CALCULATE, CLEAR FOR NEXT ITEM, ORDER COMPLETE, SUMMARY, PRINT, and EXIT. the CALCULATE button should display the item amount and add to the subtotal. the CLEAR FOR NEXT ITEM button clears the check box for new releases, the movie title, and the radio buttons; the member check box cannot be changed until the current order is complete. include validation to check for missing data. if the user clicks on the CALCULATE button without first entering the movie title and selecting the movie format, display a message box.
for the ORDER COMPLETE button, first confirm the operation with the user and clear the controls on the form for a new customer.
the SUMMARY button displays the number of customers and the sum of the rental amounts in a message box. make sure to add to the customer count and rental sum for each customer order.
oh dear. i’m sorry. it’s the calculations im have a problem with. you see when my grandson showed me this thing i was having fun. now i’m at chapter 4 and i am so flustered. i dont want to give up but this is hard
Jennifer Evans says
Do you know how to add event listeners? Or is it the problem and the calculations that you don’t really understand?
Don’t give up! Anything worth doing in life is not easy! I am here to help you! Programming is my career and my passion, and I love seeing people enjoy it.
I find that a key to success in programming is a good attitude. You should know, going into this, that programming is not easy. There will be many hours spent on tedious problems where you want to rip out your hair. The key is to enjoy the frustration, and see it as a puzzle to be worked out. A challenge! The feeling of finally figuring it out and creating something of your very own is so rewarding, and makes you just glow! So chin up! Don’t ever think you can’t do it, because you’re defeating yourself before you even begin. I learned this early on when I began studying programming in college. So let’s get to it!
Also, a piece of advice: I like to jot down on a piece of paper in note form (or pseudo-code) what needs to be done. That way I don’t forget anything and I can order things where they are supposed to happen. I find it’s handy for programs that you have to write a lot of code for or programs that get tangly. It’s a good way to organize thoughts.
The calculate button is the only button that requires calculations. The others either clear, display data, or exit the program. Since it is the calculations you are having trouble with, I will talk about that one here. But let me know if you have trouble with the others!
I don’t wanna tell you too much, as it would defeat the purpose of learning. So I will give you a kind of pseudo-code. It says in your problem that the calculate button will display the item amount and add to the subtotal. In order to do this, we have to determine which radio button is selected and which, if any, check boxes are checked. This will affect how much the item is worth. Let’s review the information we are given:
VHS – $1.80 DVD – $2.50
VHS – $2.00 (New Release) DVD – $3.00 (New Release)
Members receive 10% discount.
Pseudo-code:
find which radio button is selected (VHS or DVD?)
if selected radio button is VHS
if new release check box is checked
price is $2.00
else
price is $1.80
else if selected radio button is DVD
if new release check box is checked
price is $3.00
else
price is $2.50
End if
if member check box is checked
discount price by 10%
end if
display price to the form in a small label so the user can see
add price to subtotal (subtotal being a global variable declared outside the subs)
If you need any additional help or any help in future, please feel free to email me! I’d love to help! I often tutored my friends in college. :)
Harley Drive says
you are wasting your time, with programming you can either do it easily or it is impossibly difficult, plus there are no worthwhile programs you can write without hundreds of hours of coding and error checking