473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Using a matrix to produce a result

I have generated a form that inserts travel information and I need to
manipulate that info. All the info is now stored in variable and i need to
generate prices... Its a little complicated cos there is not a relative
price structure. Ill try and explain whets happening...

variable1 - either european or worldwide
variable2 - 1_person, 2_people or a family
variable3 - standard_baggage or include_luggage
variable4 - length of trip (either 1-5, 6-10, 11-17, 18-24, 25-31 & 32-38
days)

the first 3 variables are radio buttons and the last one is a text box and I
have all the info in variables. You must remember that there are many many
different instances for the prices and I need to know how to get this
correctly working???

Thanks
Scott
Nov 21 '05 #1
5 1046
Scott,

Probably you get more and better answers when you answers the replies you
get from people (like me) to make your problem more understandable what you
are up to.

(I asked you by instance if this was for a PC or for a PDA) because you was
talking about a calculator.

And when it is the first the second question would be than if it was for a
winform or a webform.

Just my thought,

Cor
Nov 21 '05 #2
"Scott" <ho*******@virgin.net> wrote in message
news:uk***************@newsfe3-gui.ntli.net...
I have generated a form that inserts travel information and I need to
manipulate that info. All the info is now stored in variable and i need to generate prices... Its a little complicated cos there is not a relative
price structure. Ill try and explain whets happening...

variable1 - either european or worldwide
variable2 - 1_person, 2_people or a family
variable3 - standard_baggage or include_luggage
variable4 - length of trip (either 1-5, 6-10, 11-17, 18-24, 25-31 & 32-38
days)

the first 3 variables are radio buttons and the last one is a text box and I have all the info in variables.


A suggestion -

European or Worldwide - 2 possible cases
Standard or Include luggage - 2 possible cases
1, 2, or family - 3 possible cases

That gives you twelve (2 * 2 * 3) possibilities of these three values.
With a little arithmetical jiggery-pokery, you could merge these into
a single value, as in

0 = European, 8 = WorldWide

0 = Standard (Luggage), 4 = Include

0 = 1 person
1 = 2 persons
2 = family

Now, you simply add up the selected values to get a single result
for any combinatio of the three fields, as in

0 = European, Standard, 1_Person
1 = European, Standard, 2_Person
2 = European, Standard, Family
4 = European, Include, 1_Person
5 = European, Include, 2_Person
6 = European, Include, Family
8 = WorldWide, Standard, 1_Person
9 = WorldWide, Standard, 2_Person
10 = WorldWide, Standard, Family
12 = WorldWide, Include, 1_Person
13 = WorldWide, Include, 2_Person
14 = WorldWide, Include, Family

Now, if you create "bands" for your durations as well,

0 = 1-5
1 = 6-10
2 = 11-17
3 = 18-24
etc.

You can create a simple matrix linking the two (OK, it'll have a few
holes in it.)

Alternatively, you /might/ want to consider dropping all of this data
into a Database of some sort - this is /just/ what they're good at!

HTH,
Phill W.
Nov 21 '05 #3
Yeah you know what I'm talking about! What kind of coding would be needed
for this? I can't seem to think laterally on this one. but you have given
me a few ideas.. Thats progress...

Scott
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:cv**********@yarrow.open.ac.uk...
"Scott" <ho*******@virgin.net> wrote in message
news:uk***************@newsfe3-gui.ntli.net...
I have generated a form that inserts travel information and I need to
manipulate that info. All the info is now stored in variable and i need

to
generate prices... Its a little complicated cos there is not a relative
price structure. Ill try and explain whets happening...

variable1 - either european or worldwide
variable2 - 1_person, 2_people or a family
variable3 - standard_baggage or include_luggage
variable4 - length of trip (either 1-5, 6-10, 11-17, 18-24, 25-31 & 32-38
days)

the first 3 variables are radio buttons and the last one is a text box
and

I
have all the info in variables.


A suggestion -

European or Worldwide - 2 possible cases
Standard or Include luggage - 2 possible cases
1, 2, or family - 3 possible cases

That gives you twelve (2 * 2 * 3) possibilities of these three values.
With a little arithmetical jiggery-pokery, you could merge these into
a single value, as in

0 = European, 8 = WorldWide

0 = Standard (Luggage), 4 = Include

0 = 1 person
1 = 2 persons
2 = family

Now, you simply add up the selected values to get a single result
for any combinatio of the three fields, as in

0 = European, Standard, 1_Person
1 = European, Standard, 2_Person
2 = European, Standard, Family
4 = European, Include, 1_Person
5 = European, Include, 2_Person
6 = European, Include, Family
8 = WorldWide, Standard, 1_Person
9 = WorldWide, Standard, 2_Person
10 = WorldWide, Standard, Family
12 = WorldWide, Include, 1_Person
13 = WorldWide, Include, 2_Person
14 = WorldWide, Include, Family

Now, if you create "bands" for your durations as well,

0 = 1-5
1 = 6-10
2 = 11-17
3 = 18-24
etc.

You can create a simple matrix linking the two (OK, it'll have a few
holes in it.)

Alternatively, you /might/ want to consider dropping all of this data
into a Database of some sort - this is /just/ what they're good at!

HTH,
Phill W.

Nov 21 '05 #4
Scott,

Because you're playing with a mixture of Controls (CheckBoxes,
TextBoxes, etc.) you're probably going to need your own function
to do the "adding up", so you can call it from each Event Handler,
something like:

Private Function CalcTravelType() as Integer
Dim iRC as Integer = 0

'If Me.Radio1Person.Checked Then
' iRC += 0
If Me.Radio2Person.Checked Then
iRC += 1
ElseIf Me.RadioFamily.Checked Then
iRC += 2
End If

'If Me.RadioStdLuggage.Checked Then
' iRC += 0
If Me.RadioIncLuggage.Checked Then
iRC += 4
End If

'If Me.RadioEuropean.Checked Then
' iRC += 0
If Me.RadioWorldWide.Checked Then
iRC += 8
End If

Return iRC
End Function

Private Sub RadioPersons_CheckChanged( _
ByVal sender as Object _
, ByVal e as ... _
)

DoSomethingWith( CalcTravelType() )

End Sub

Private Sub TextDuration_Validated( _
ByVal sender as Object _
, ByVal e as ... _
)

DoSomethingWith( CalcTravelType() )

End Sub

HTH,
Phill W.

"Scott" <ho*******@virgin.net> wrote in message
news:J_***************@newsfe1-gui.ntli.net...
Yeah you know what I'm talking about! What kind of coding would
be needed for this? I can't seem to think laterally on this one.
But you have given me a few ideas.. Thats progress...

Nov 21 '05 #5
"Scott" <ho*******@virgin.net> wrote in message
news:uk***************@newsfe3-gui.ntli.net...
I have generated a form that inserts travel information and I need to
manipulate that info. All the info is now stored in variable and i need to
generate prices... Its a little complicated cos there is not a relative
price structure. Ill try and explain whets happening...

variable1 - either european or worldwide
variable2 - 1_person, 2_people or a family
variable3 - standard_baggage or include_luggage
variable4 - length of trip (either 1-5, 6-10, 11-17, 18-24, 25-31 & 32-38
days)

the first 3 variables are radio buttons and the last one is a text box and
I have all the info in variables. You must remember that there are many
many different instances for the prices and I need to know how to get this
correctly working???

Thanks
Scott

If I was working on this, my data would be in a dataset and this'd be
written to a table.
The controls involved wouldn't matter so much.
I'd also have everything else in tables...
The calculation would be a case of (destinationCost + luggage + etc) per
person
--
Regards,
Andy O'Neill
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: christopher diggins | last post by:
Here is some code I wrote for Matrix multiplication for arbitrary dimensionality known at compile-time. I am curious how practical it is. For instance, is it common to know the dimensionality of...
14
by: amitnanda | last post by:
Hi Guys, I have a matrix multiplication program in C that multiplies two matrices. When their size is 3*3 or 800*800, the program runs fine. But above that size, I get a "segmentation fault"....
16
by: Martin Jørgensen | last post by:
Hi, I've made a program from numerical recipes. Looks like I'm not allowed to distribute the source code from numerical recipes but it shouldn't even be necessary to do that. My problem is...
7
by: check.checkta | last post by:
Hi, I'd like to implement a simple matrix class. I'd like to overload operator so that it returns as a vector (either the stl vector or some other Vector class of my own). The reason I want...
1
by: Preben | last post by:
Hi, don't know if this is the correct group, but try anyway. I would like to use boostbindings from the boost sandbox together with my project where I use boost::numeric::ublas vectors and...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
12
by: sugard | last post by:
I am a java beginner and I was given this task to do.. to create a class which given 2 matrices,and these bein of the correct dimensions, will produce a third matrix by multiplying both. There is the...
5
by: Envergure | last post by:
I wrote a function to find the point of intersection of a line and a plane in three-space. This function works fine and returns the correct result. However, when I call it using an element from...
3
by: okcomputer24 | last post by:
I am wanting to produce a number matrix which will result in displaying the numbers in chronological order. For example, if a 3 x 3 matrix is desired, the output would result as such: ,,] The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.