Computer Science Canada help me in array |
Author: | MadeinChina [ Tue Mar 07, 2006 7:14 pm ] |
Post subject: | help me in array |
need help on this program i suk in VB :/ A school auditorium has 20 rows lettered A···T with 25 seats per row numbered 1···25. Write a program to keep track of the seat sales. The price breakdown for seats is . Rows A···E - $12.00 Rows F···K - $8.50 Rows L···T - $6.25 1. The program should be able to display which seats are sold or which seats are available for any single section when requested. 2. The program should be able to determine and display the total dollar sales and the total number of seats sold for the auditorium or for any single section when requested. _______________________________ Basic Program ____________________________ 3. The program should allow for the purchase of more than one seat and display the seats purchased and the total cost for that transaction. 4. The program should allow for the price of the seats to be changed depending on the event. 5. The program should allow for the section designations to be changed depending on the event. Assume that there is a maximum number of three sections. 6. The program should allow tickets to be refunded. Notes: · All seat references should consist of the row letter followed by the seat number. e.g. A10 · All dollar amounts should be formatted. e.g. $980.50 · The GUI should be user friendly I think this program mostly needs is array and finding array lol help plz |
Author: | cool dude [ Tue Mar 07, 2006 9:05 pm ] |
Post subject: | |
and your question is...? ![]() your program is very simple, but nobody will do it for u. u have to try it, and if u still can't do it then post the question u need help with, not posting to do the program for u. READ THE RULES!!! |
Author: | MadeinChina [ Tue Mar 07, 2006 9:24 pm ] |
Post subject: | |
my bad i want to know like the concept or what to do. |
Author: | GlobeTrotter [ Tue Mar 07, 2006 9:51 pm ] | ||||||||||
Post subject: | |||||||||||
Look into Types. This is an example to get you started. I'm not entirely sure if all of the syntax is even correct. In a module, have:
It may make the coding easier to make three arrays of rows, for each sections. Or you can just use one, which is what I'll show. Either way works. In declarations, write something like:
Then in your Initialization procedure (probably Form_Load) have something like this:
I think you get the point. The key is to keep it organized with types, also known as records. Then create an array of these Types. Arrays in VB are simply declared like so:
That will give you an array of numbers 1 through 4 (In fact that gives you 5 numbers, counting zero, but ignore that) Then you simple assign or compare like so
As for your form, be sure to look into control arrays to interface your array with your form. Hope that helps. |
Author: | cool dude [ Thu Mar 09, 2006 4:41 pm ] | ||||
Post subject: | |||||
Quote: Dim iNumbers (4) As Integer. That will give you an array of numbers 1 through 4 (In fact that gives you 5 numbers, counting zero, but ignore that) Then you simple assign or compare like so no u should not ignore that because it will give u an error. u can either do it
OR
this one includes the 0 the first one doesn't. it's important to make sure u know if your using the zero or not or u wont get correct results. |
Author: | GlobeTrotter [ Thu Mar 09, 2006 7:12 pm ] |
Post subject: | |
I agree that it isn't the greatest practice, but it does not give you an error. VB (VB6) at least is lenient with the issue. |