Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help me in array
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MadeinChina




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Tue Mar 07, 2006 9:05 pm   Post subject: (No subject)

and your question is...? Question

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!!!
MadeinChina




PostPosted: Tue Mar 07, 2006 9:24 pm   Post subject: (No subject)

my bad i want to know like the concept or what to do.
GlobeTrotter




PostPosted: Tue Mar 07, 2006 9:51 pm   Post subject: (No 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:

code:

Public Type SeatType
   Purchased As Boolean
End Type

Public Type RowType
   Cost As Single
   LetterID As String
   Seat (25) As SeatType
End Type



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:
code:

   Dim RowArray  (20) As RowType


Then in your Initialization procedure (probably Form_Load) have something like this:

code:

Dim iRowCount As Integer
Dim iSeatCount As Integer

For iRowCount = 1 to 20
   For iSeatCount = 1 to 25
      RowArray(iRowCount).Seat(iSeatCount).Purchased = False
   Next iSeatCount
   RowArray(iRowCount).LetterID = Chr(iRowCount) 'SOmething like that, play with it until it works and lines up with A through T
   If iRowCount <= 5 then
      RowArray(iRowCount).Cost = #
   End If 'etcetera
Next iRowCount


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:

code:

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

code:

iNumbers (1) = 4


As for your form, be sure to look into control arrays to interface your array with your form.

Hope that helps.
cool dude




PostPosted: Thu Mar 09, 2006 4:41 pm   Post subject: (No 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

code:

dim iNumbers(1 to 4) as integer


OR

code:

dim iNumbers(3) as integer


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.
GlobeTrotter




PostPosted: Thu Mar 09, 2006 7:12 pm   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: