 |

September 2nd, 2008, 02:49 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
Randomizing Calculation Variables.
Hi everyone!
I'm currently working on a project where I have no idea where to begin because I'm really bad at programming and thus, the reason why I'm posting here. To start off with, my project supervisor wants us to use the following programs:
1. Visual Web Developer
2. Visual Basic
3. SQL
He wants us to come up with a code that allows users to enter a equation but the variables can be randomized, meaning...
y = mx + c
The variables being 'x' and 'c'.
So after you type in y = mx + c (most likely must come up with interface), the variables are to randomize themselves every time a person starts the quiz.
*Must not be hard coded.
The users are people who do not care what goes on behind the scenes, meaning, they want nothing to do with the codings, and it must be user friendly. How will I be able to make the codings work like that based on the code language that I am allowed to work with.
Thanks for the help in advance!
- Denise
p/s You can email me at denisetay17@hotmail.com
Last edited by yourstonight; September 2nd, 2008 at 02:50 AM.
Reason: Wrong Title
|

September 2nd, 2008, 03:28 PM
|
 |
Familiar Sight
|
|
Join Date: Jul 2007
Location: tamil nadu, INDIA
Age: 20
Posts: 187
|
|
One thing you can do is make a list of all the equations you think the use might use,prompt the user to click any one of them and then ask the user to enter values for respective variables.
Another method is you can get the equation in a string variable,calc the number of variables involved(excluding the numbers and operators all other characters are variables),form a general equation,compare it with the list of equations you have to confirm to which type the entered equation belongs.
i do have something else to say..this site is not for training people who are bad at programming,rather a site for developers across the world to share their views and ways of solving general problems.
|

September 2nd, 2008, 07:51 PM
|
 |
Expert
|
|
Join Date: Apr 2007
Location: Mexico City
Age: 25
Posts: 1,084
|
|
^.^
First of all, you'll need something to evaluate mathematical expressions, check this article out.
once you can evaluate them, you can do something like this (using the EVAL function from the article), please note this is a simple example and it can clearly be improved (so can the articles' code):
Code:
'this little example will search every letter form a to z, using its ascii code (from 97 to 122) and the REPLACE function.
'
dim str1 as string
dim i as integer
randomize
str1= inputbox("write the function here")
for i = 97 to 122
str1=replace(str1, chr(i),rnd*100)
next
msgbox str1 & " = " & eval(str1)
I think that'll give you a good idea, and can be quite general for any purpose
I tried it with a+b*c (it'll give you the other side, son dont write both sides of ecuation, write only one) and returned:
81.59072+74.97083*78.8576 = 5993.610443808
^.^ nice!!
Anyway, im sure that with some time you can improve this quite a bunch.
HTH
|

September 3rd, 2008, 02:19 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
Oh thanks for the help everyone :) Really appreciate it. Gotta do up the interface first and even tho' I don't really understand the codes, I'll do the best of my ability. Lol.
|

September 3rd, 2008, 02:25 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
Quote:
|
Originally Posted by vdraceil
One thing you can do is make a list of all the equations you think the use might use,prompt the user to click any one of them and then ask the user to enter values for respective variables.
Another method is you can get the equation in a string variable,calc the number of variables involved(excluding the numbers and operators all other characters are variables),form a general equation,compare it with the list of equations you have to confirm to which type the entered equation belongs.
i do have something else to say..this site is not for training people who are bad at programming,rather a site for developers across the world to share their views and ways of solving general problems.
|
I merely asked a question that you could have chosen not to reply. The website says I could ask questions. It doesn't say you can't ask, if you're bad at programming. Thanks for your reply but you didn't understand the question in the first place.
|

September 3rd, 2008, 06:28 PM
|
 |
Familiar Sight
|
|
Join Date: Jul 2007
Location: tamil nadu, INDIA
Age: 20
Posts: 187
|
|
Quote:
|
Originally Posted by yourstonight
I merely asked a question that you could have chosen not to reply. The website says I could ask questions. It doesn't say you can't ask, if you're bad at programming. Thanks for your reply but you didn't understand the question in the first place.
|
Sorry buddy..i didnt mean to hurt you..really sorry
|

September 4th, 2008, 02:40 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
Quote:
|
Originally Posted by vdraceil
Sorry buddy..i didnt mean to hurt you..really sorry
|
Sorry too, I'm just running out of places to get help. :(
|

September 4th, 2008, 03:10 AM
|
 |
Expert
|
|
Join Date: Apr 2007
Location: Mexico City
Age: 25
Posts: 1,084
|
|
Quote:
|
Originally Posted by yourstonight
Sorry too, I'm just running out of places to get help. :(
|
dont worry, i think we can work this out quite fine. ^.^
did you get to make it work?
|

September 5th, 2008, 05:30 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
I used another method to make it work but I haven't figured out how to integrate the randomization code into it yet. I just managed to do up the interface and make y=mx+c
|

September 5th, 2008, 10:30 AM
|
|
Familiar Sight
|
|
Join Date: Mar 2008
Posts: 244
|
|
at the moment I don't have anything to add but I would really recomend against posting your email address in a public forum as it is all too easy to get on a spammers list and it is a much better option to state that you can be pm'd
if you do wish to post an email address it is better to try and hide it from some of the spider programs by at least removing the @ sign
Somebody<insert @ here>anywhere.net
|

September 5th, 2008, 10:40 AM
|
|
Familiar Sight
|
|
Join Date: Mar 2008
Posts: 244
|
|
quick example code for random numbers as above looks a little complicated
Code:
Dim y, m, x, c As Integer
m = 1
Randomize()
x = 50 * Rnd() ' random number up to 50
c = 50 * Rnd() ' random number up to 50
y = m * x + c
MsgBox(y)
|

September 8th, 2008, 04:12 AM
|
|
Newbie
|
|
Join Date: Sep 2008
Posts: 6
|
|
[quote=jg007]quick example code for random numbers as above looks a little complicated
Code:
Dim y, m, x, c As Integer
m = 1
Randomize()
x = 50 * Rnd() ' random number up to 50
c = 50 * Rnd() ' random number up to 50
y = m * x + c
MsgBox(y)
[/QUOTE
Thanks for the tip and the quick example. I'll remove my email asap :)
|
 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|