Author Topic: DO You Know Visual Basic?  (Read 1268 times)

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
DO You Know Visual Basic?
« on: January 24, 2008, 11:35:34 PM »
I need an explanation for this.  If you have a clue what to do PLEASE PM me.

Thanks !!!!


Assignment ID 2    Algebraic Function Checker

This assignment requires the creation of an application that accepts three numeric values ( use single or double) and then computes a value based on these inputs.   The format is  Z = f(i,j,k) and shown below.  Use input field editing ( see JF 1 for hints so that your application is bullet proof.  Hint: you may need to use conditional logic to guarantee a bullet proof solution.

The formula is  Z = 5i + (3j - 2) / (4(3k-24) - i)

Provide PDL and a running application.


gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #1 on: January 25, 2008, 12:57:01 AM »
From what I remember of visual basic ( this was version 6 so may be different to .NET):

Function Z(i as double, j as double, k as double) As double

  dim d as double

  d = (4*(3*k - 24) - i)

  if (d <> 0) then
    Z = 5*i + (3*j - 2) / d
  else
    Z = 0
  end if

End Function

gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #2 on: January 25, 2008, 12:57:55 AM »
You will still have to create a GUI interface for it though

gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #3 on: January 25, 2008, 01:02:14 AM »
I don't know what he means by input field editing - but the issue is definitely the 0 determinant in the division.

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #4 on: January 25, 2008, 01:07:37 AM »
I don't know what he means by input field editing - but the issue is definitely the 0 determinant in the division.

Input field editing I can answer.  It is a routine to check if they put in a number instead of letter.  If not then messagebox.show ("wrong input dumbfuck")..lol



gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #5 on: January 25, 2008, 01:09:49 AM »
what does visual basic do when you divide by zero - it throws some sort of exception as well doesn't it?

gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #6 on: January 25, 2008, 01:10:57 AM »
you probably want a message division by zero as well

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #7 on: January 25, 2008, 01:12:00 AM »
From what I remember of visual basic ( this was version 6 so may be different to .NET):

Function Z(i as double, j as double, k as double) As double

  dim d as double

  d = (4*(3*k - 24) - i)

  if (d <> 0) then
    Z = 5*i + (3*j - 2) / d
  else
    Z = 0
  end if

End Function


OK thanks for replying...  where do you get d?  I am so lost.

Jesus Christ ...I am dropping this class.  This is the second assignment that is supposed to be intro to programming and logic.  This class starts off balls to the wall as if everyone already is a coder.

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #8 on: January 25, 2008, 01:25:27 AM »
what does visual basic do when you divide by zero - it throws some sort of exception as well doesn't it?

You got me man.  I am a network admin for 10 years.  This programming shit is for a different breed.  How is anyone supposed to "just know" what to put down in code?  I can GUI all day but when it comes down to coding a button....pfft.  forget it.  I can read a finished project to a certain degree but I could not tell you why it was coded that way if that makes sense.

Faust

  • Getbig IV
  • ****
  • Posts: 3154
  • It's a league game, Smokey
Re: DO You Know Visual Basic?
« Reply #9 on: January 25, 2008, 02:03:13 AM »
You got me man.  I am a network admin for 10 years.  This programming shit is for a different breed.  How is anyone supposed to "just know" what to put down in code?  I can GUI all day but when it comes down to coding a button....pfft.  forget it.  I can read a finished project to a certain degree but I could not tell you why it was coded that way if that makes sense.
Dude, you just need some practice.
When you have a problem, it helps to think out a small algorithm how you would solve it. Write that down. Think about certain problems and how you would solve them. E.g. here there is the possibility of dividing by zero, you can work around it the way gcb pointed out.

The implementation (coding) itself is just learning how to do certain things (like loops) along the way. Ask a lot of questions to the assistants or professors, or fellow students. I always did that, it's the fastest and easiest way.

If you are not a natural, you're just gonna have to put in extra time to make more excercises, but everyone can learn it imo.
$

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #10 on: January 25, 2008, 02:14:07 AM »
Dude, you just need some practice.
When you have a problem, it helps to think out a small algorithm how you would solve it. Write that down. Think about certain problems and how you would solve them. E.g. here there is the possibility of dividing by zero, you can work around it the way gcb pointed out.

The implementation (coding) itself is just learning how to do certain things (like loops) along the way. Ask a lot of questions to the assistants or professors, or fellow students. I always did that, it's the fastest and easiest way.

If you are not a natural, you're just gonna have to put in extra time to make more excercises, but everyone can learn it imo.

I have ZERO Logic skills.  I am a lifetime failure at algebra.  I took it 5 times.  Still don't have the credit.  That's why this stuff blows my mind.  I will go to one more class and if I do not get a clearer vision... then I am going to retire from school as long as I can.  I am going on 39 now and I have lost my motivation.  Maybe I will try being an auto mechanic or something.  Maybe deal drugs.

Faust

  • Getbig IV
  • ****
  • Posts: 3154
  • It's a league game, Smokey
Re: DO You Know Visual Basic?
« Reply #11 on: January 25, 2008, 02:30:02 AM »
I have ZERO Logic skills.  I am a lifetime failure at algebra.  I took it 5 times.  Still don't have the credit.  That's why this stuff blows my mind.  I will go to one more class and if I do not get a clearer vision... then I am going to retire from school as long as I can.  I am going on 39 now and I have lost my motivation.  Maybe I will try being an auto mechanic or something.  Maybe deal drugs.
You are 38 and still in college?
$

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #12 on: January 25, 2008, 05:35:50 AM »
You are 38 and still in college?

No I have not been in college for 20 years...lol.

I went when I got outta high school and played Baseball.  When I got hurt I quit and started working then fast forward to 1997.  I get an MCSE while I am going to college once again...lol... to start my Info Sys career.  Got offered a job in I.T.  never went back to school but earned several more Certs.  Been in the I.T. game for 10 years.  Still trying to get an Associates but it has to be in IT since my company pays for it.  Kinda sucks.  Otherwise I would go for the ever popular Liberal Arts degrees.  That is a cakewalk.  I know it's a long reply but I just smoked a J.

Butterbean

  • Moderator
  • Getbig V
  • *****
  • Posts: 19326
Re: DO You Know Visual Basic?
« Reply #13 on: January 25, 2008, 06:38:45 AM »
  I know it's a long reply but I just smoked a J.
That's only good for geometry
R

w8m8

  • Guest
Re: DO You Know Visual Basic?
« Reply #14 on: January 25, 2008, 06:58:17 AM »

 I just smoked a J.


that was the only part I understood

Liberal Arts even "sounds" better  ;)





gcb

  • Getbig IV
  • ****
  • Posts: 2283
  • you suffer, why?
Re: DO You Know Visual Basic?
« Reply #15 on: January 28, 2008, 04:58:48 PM »

OK thanks for replying...  where do you get d?  I am so lost.

Jesus Christ ...I am dropping this class.  This is the second assignment that is supposed to be intro to programming and logic.  This class starts off balls to the wall as if everyone already is a coder.

I only use d as a temporary to make sure I'm not going to divide by zero.

Livewire

  • Getbig IV
  • ****
  • Posts: 3134
  • I call Nasser.
Re: DO You Know Visual Basic?
« Reply #16 on: January 28, 2008, 09:02:39 PM »
you probably want a message division by zero as well

SUP NUGGA
Nasser called Palumbo an acromegalion

dkf360

  • Getbig II
  • **
  • Posts: 274
  • Getbig!
Re: DO You Know Visual Basic?
« Reply #17 on: January 28, 2008, 10:41:41 PM »
GCB pretty much provided the solution to the logic in your code, now you just need to put structure to it.

1) Visual Basic uses drag and drop to create the UI, so it's pretty easy to do.
2) Create three input boxes and a button for the user to kick off the event to compute the code as the UI.
3) Now you have to verify each input box is a number, so in the button event code block, you can do something like this for each input box:

input1 = InputBox("Please enter a numeric value", "Title to Input Box")
Loop Until IsNumeric(input1) = True

This will check if the input is a number. 
4) Only if all three input box returns a true would you then pass the three values into the function GCB provide

result = Z(input1, input2, input3)

5) Now pass the 'result' to a display dialog or however you want to present the answer.

windsor88

  • Getbig IV
  • ****
  • Posts: 2580
  • Victim of the Drug War
Re: DO You Know Visual Basic?
« Reply #18 on: January 30, 2008, 01:28:49 PM »
GCB pretty much provided the solution to the logic in your code, now you just need to put structure to it.

1) Visual Basic uses drag and drop to create the UI, so it's pretty easy to do.
2) Create three input boxes and a button for the user to kick off the event to compute the code as the UI.
3) Now you have to verify each input box is a number, so in the button event code block, you can do something like this for each input box:

input1 = InputBox("Please enter a numeric value", "Title to Input Box")
Loop Until IsNumeric(input1) = True

This will check if the input is a number. 
4) Only if all three input box returns a true would you then pass the three values into the function GCB provide

result = Z(input1, input2, input3)

5) Now pass the 'result' to a display dialog or however you want to present the answer.

Thanks for the Error checking script.  I can use that.  Even with these little inputs from folks it REALLY helps me understand efficient ways to code.  You should see my first attempt at this problem...lol.