Home | Community | Message Board


Everything Mushrooms
Please support our sponsors.

Community >> The Smoke Lounge

Welcome to the Growery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Jump to first unread post. Pages: 1
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Javascript Help
    #271800 - 08/28/09 05:50 PM (7 years, 3 months ago)

I'm not real good in java even though its very similar to c/c++ I'm just having trouble helping a friend with some homework. So the object is, is to take the input of 3 numbers and do a few if statements which I have done...Then at the end have it find the largest of the number1.number2.and number3 variables and I cannot remember how to do it. I know how to sort but I can't for the life of me remember how to do it...I could use a bunch of IF statements I suppose but there has to be a better way:

Quote:

<html>
<head>
<script type="text/javascript">
<!--

var firstnum;
var secnum;
var thirdnum;
var number1;
var number2;
var number3;
var sum;
var largest;

firstnum = window.prompt( "Number 1" );
secnum = window.prompt( "Number 2" );
thirdnum = window.prompt( "Number 3" );

number1 = parseFloat( firstnum )
number2 = parseFloat( secnum )
number3 = parseFloat( thirdnum )

sum = parseFloat( number1 + number2 + number3 );

if ( sum%2==0 )
{
window.alert( "Average of the three numbers is : " + sum / 3 )
}

if ( sum%2==1 )
{
document.writeln( "<h1>Product of the three numbers is : " + number1 * number2 * number3 + "</h1><br><br>" );
}

if ( number1 >= number2 )
{


//-->
</script>
</head>
</html><html>
<head>
<script type="text/javascript">
<!--

var firstnum;
var secnum;
var thirdnum;
var number1;
var number2;
var number3;
var sum;
var largest;

firstnum = window.prompt( "Number 1" );
secnum = window.prompt( "Number 2" );
thirdnum = window.prompt( "Number 3" );

number1 = parseFloat( firstnum )
number2 = parseFloat( secnum )
number3 = parseFloat( thirdnum )

sum = parseFloat( number1 + number2 + number3 );

if ( sum%2==0 )
{
window.alert( "Average of the three numbers is : " + sum / 3 )
}

if ( sum%2==1 )
{
document.writeln( "<h1>Product of the three numbers is : " + number1 * number2 * number3 + "</h1><br><br>" );
}

//-->
</script>
</head>
</html>




That's what I have and after the last IF statement is where it should go...Someone help please


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisibletsollost
Master of Mopery

Registered: 06/01/08
Posts: 4,662
Re: Javascript Help [Re: mhbound]
    #271832 - 08/28/09 07:10 PM (7 years, 3 months ago)

damn, i won't be versed with java until the end of this semester.
assuming i get it


--------------------
GUNGA GALUNGA


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: tsollost]
    #271833 - 08/28/09 07:16 PM (7 years, 3 months ago)

Well you might be taking it with my friend...CS205? I was going to call you last night but we left the bars and then like everyone got in a fight outside the booth and I got hit so I hit somebody and it went from there. If you need help I already took 205 I'm decent good enough to help and he is also taking it so I could introduce you to him because he is lost...It would help you to help him. Anyway yearrrr


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisibletsollost
Master of Mopery

Registered: 06/01/08
Posts: 4,662
Re: Javascript Help [Re: mhbound]
    #271836 - 08/28/09 07:25 PM (7 years, 3 months ago)

maybe 202, i think it may be html with java at the end


--------------------
GUNGA GALUNGA


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: tsollost]
    #271837 - 08/28/09 07:28 PM (7 years, 3 months ago)

Yea, are you a CS minor?


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisibletsollost
Master of Mopery

Registered: 06/01/08
Posts: 4,662
Re: Javascript Help [Re: mhbound]
    #271839 - 08/28/09 07:30 PM (7 years, 3 months ago)

nah, i might switch though. hadn't really considered that.
right now i may have anthro as my minor but i've had just as many if not more cs classes so it wouldn't be a big deal prob.


--------------------
GUNGA GALUNGA


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: tsollost]
    #271841 - 08/28/09 07:35 PM (7 years, 3 months ago)

The hardest class is CS 205 after that its fairly easy. I'm a MIS major so I don't know first hand but I do know from others telling me that the hardest CS minor class is 205 and I would have to agree..Its strictly java.


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisibletsollost
Master of Mopery

Registered: 06/01/08
Posts: 4,662
Re: Javascript Help [Re: mhbound]
    #271843 - 08/28/09 07:38 PM (7 years, 3 months ago)

word.
you said it was similar to c/c++?
i've had a class or two of programming but that was back in highschool so i'd probably be pretty dusty on that


--------------------
GUNGA GALUNGA


Post Extras: Print Post  Remind Me! Notify Moderator
InvisibleFurrowedBrowM
Free yourself from yourself
Male User Gallery


Registered: 04/20/08
Posts: 12,037
Loc: Carpal Tunnel
Re: Javascript Help [Re: tsollost]
    #271845 - 08/28/09 07:47 PM (7 years, 3 months ago)

Did you ask all those fucking nerds on the Shroomery?


--------------------





Multidisciplinary Association for Psychedelic Studies - Become a member!
The Growery's Herb Museum (post #24)
I prefer dangerous freedom to peaceful slavery.
~ Thomas Jefferson ~


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: FurrowedBrow]
    #271846 - 08/28/09 07:49 PM (7 years, 3 months ago)

:lol:

Yea I got it figured out I knew how to do it the way they suggested I just figured there was an easier function or something but I guess not. But yea after this route didn't work I was like all these god damn potheads won't know so I went over there real quick.

And yea its almost exactly like c/c++ I mean to a T just look at the syntax and how the code in my first post is written its like the little bro of c or something.


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: mhbound]
    #279690 - 09/13/09 08:38 PM (7 years, 2 months ago)

Ok so I'm doing a friends homework again and like I said I haven't touched java much in the last few years but it was one of my first languages to dabble in...Anyway, I need to know how to check if the input is null something like:

Quote:

var x;

x = window.prompt( "Enter a number..." )

if( x = null )              or whatever it is
{
  statement for my code here
}




How do you do that...I can never remember small things like this but everything else is no problem...Anyway this is what I have so far its not quite done though...Pretty simple but if someone can tell me how to check to see if its null that would be cool.

Quote:

<head>
<script type="text/javascript">
<!--

var i=1;
var number;
var odd = 0;
var even = 0;
var sumEven = 0;
var sumOdd = 0;

parseFloat( number );
parseFloat( even );
parseFloat( odd );

while (i<=10)
{

number = window.prompt( " Enter number: " + i );

if( number < 0 )
{
window.prompt( "WWWHAT" )
}

if( number%2==0 )
{
document.write( i + ".) " + "( " + number + " )" + " is even. ( " + ( even + 1 ) + " even numbers )" );
document.write( "<br />" );
even = ( even + 1 );
i=i+1;
}

if( number%2==1 )
{
document.write( i + ".) " + "( " + number + " )" + " is odd. ( " + ( odd + 1 ) + " odd numbers )" );
document.write( "<br />" );
odd = ( odd + 1 );
i=i+1;
}

}

document.write( "<br />" );
document.write( even + " even numbers" );
document.write( "<br>" );
document.write( odd + " odd numbers" );

//-->
</script>
</head>




--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblecoda


Registered: 04/20/08
Posts: 4,734
Re: Javascript Help [Re: mhbound]
    #279780 - 09/13/09 11:19 PM (7 years, 2 months ago)

if (null == yourvar)

In javascript using the = sign by itself assigns the variable a value.  two equal signs check for equality.


--------------------


MFDoom666: sobriety kills my buzz every time.


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: coda]
    #279786 - 09/13/09 11:25 PM (7 years, 2 months ago)

Nice, yea thats right I knew that just didn't think about it writing this post. Thanks for your help mangg :thumbup:

That will save me the hassle of going back through my old books to find a simple ass line of code  :bow2:

Are you good in javascript? Or just mess around a little like myself?


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblecoda


Registered: 04/20/08
Posts: 4,734
Re: Javascript Help [Re: mhbound]
    #279790 - 09/13/09 11:29 PM (7 years, 2 months ago)

I'm a vb.net developer by trade, learned java in school and was pretty good at it, never really wrote much javascript honestly.  But java and jscript are damn near the same thing so it's not much of a stretch for me to look at the code and figure it out.


--------------------


MFDoom666: sobriety kills my buzz every time.


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: coda]
    #279797 - 09/13/09 11:39 PM (7 years, 2 months ago)

Yea, c, c++, java, script all are so similar its pretty easy to bounce around with a little work. I really like vb.net I took a couple of classes on it myself. Its a pretty handy little language.

vb6 was/is my favorite language. It can be a pain in the ass to incorporate in to certain projects but I really like it...Of course it was the first language I TRULY(not 6 but vb in general) learned after dabbling in fortran for a few months...Now thats a language if you want to learn one damn I hated that shit.

I wish I had the patience to sit down and develop software but I don't...I'm pretty good at it and I enjoy it but there is no way I could do it for a living...We should teamup and design some database software for people who need to keep inventory and so on. Something like this:

http://www.southware.com/

I do networks and things like that...Well this last job I went on and worked there for awhile used southware I FUCKING HATED THAT GOD DAMN BULLSHIT! I sat there and thought if I had a team of people I would design software for these people and then go sell it to everyone else because that shit was a fucking joke. I hated it with everything I had in my body and I didn't even run the software hardly ever.

Anyway, I need to shut it.


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblecoda


Registered: 04/20/08
Posts: 4,734
Re: Javascript Help [Re: mhbound]
    #279857 - 09/14/09 12:34 AM (7 years, 2 months ago)

Quote:

Vb6 was/is my favorite language. It can be a pain in the ass to incorporate in to certain projects but I really like it..




spend some time using visual studio 2008/10, once you pick up the new things that have been introduces since VB6 you'll never want to go back.

Quote:

We should teamup and design some database software for people who need to keep inventory and so on.




funny, that's what i do for a living right now.  Although technically what i develop on is an ERP system (which does have it's own inventory module :wink:). 

Quote:

I do networks and things like that..




I did a lot of network admin work early on in my IT career.  I really enjoyed it, and still do, but somewhere along the way I really fell in love with programming and moved on from the hardware life into software development.  If i were to get back into network and network architecture again I'd have to do some serious catching up.  Last piece of server software I worked with was server 2k, and that was almost 10 years ago.  Needless to say i'm a bit rusty :wink:


--------------------


MFDoom666: sobriety kills my buzz every time.


Post Extras: Print Post  Remind Me! Notify Moderator
Invisiblemhbound
Ballin out at all cost
Male User Gallery Arcade Champion: Pingu Slap


Registered: 09/22/08
Posts: 8,142
Loc: High Flag
Re: Javascript Help [Re: coda]
    #279890 - 09/14/09 01:04 AM (7 years, 2 months ago)

:lol:

Anyone who I do basically a completely overhaul for I usually recommend 2003. I hated server 2k though its not much different from 03.

I'm getting the same way with hardware...I understand how it works, its not going to really change, and my life has become basically a repeat...I do the sameeeeeeeeee shit over and over when I never thought it would get like that.

Software is always changing, it runs the hardware(kind of - not really but in a way), and its fun to develop...Unfortunately everything that has my name on it that says I'm good to work with computers all have something to do with hardware/software but nothing in the development part. I should really pick up a serious language and learn it through and through to get a job.

I could sit here and write code all day long. A web developer is my ideal job at this point but I really don't have the time to sit there and learn html, java, php, css, hfdbkjcbgvjkdfghjklsdfg so since thats out of the question I'd just rather stick with what I know and build on it...

Any help you have to point me in the right direction would be great. If you read some of the old posts you might see that I've been bitching a lot about my jobs n stuff and I need a change. I think a career writing code would be good for me right now. Especially considering how vb.net has really picked up and more and more developers are using it. I didn't see that coming at all...Its taken over a lot of the industry and its looking like these kinds of languages are about to really going to mature in to something cool...I can't wait.


--------------------
Suck my balls America


Post Extras: Print Post  Remind Me! Notify Moderator
Jump to top. Pages: 1

Community >> The Smoke Lounge

Similar ThreadsPosterViewsRepliesLast post
* dvd burning software ltd 1,457 5 12/16/08 11:39 PM
by ltd
* tsollost
( 1 2 all )
Tcrib 2,877 31 09/14/09 01:11 PM
by Stoneth
* Google vs Pirate Bay
Hydro
1,895 17 04/22/09 05:49 PM
by Hydro
* Computer Issue
Hydro
533 0 04/19/09 11:59 AM
by Hydro
* super awesome poll
( 1 2 all )
jckmcgrth 3,604 27 10/22/08 02:26 PM
by THEBats
* PC or Mac
( 1 2 all )
dfernandez90 3,300 39 06/19/08 10:51 PM
by ezKiel
* my paypal just got hacked
( 1 2 all )
Harry_Ba11sachM 2,904 25 07/01/09 03:58 PM
by mhbound
* ableton live
( 1 2 all )
THEBats 1,879 21 12/30/08 04:10 PM
by ezKiel

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: FurrowedBrow, Harry_Ba11sach, Stoneth, Dr. Siekadellyk
1,618 topic views. 3 members, 231 guests and 376 web crawlers are browsing this forum.
[ Toggle Favorite | Print Topic | Stats ]
Search this thread:
World Seed Supply
Please support our sponsors.

Copyright 1997-2016 Mind Media. Some rights reserved.

Generated in 0.095 seconds spending 0.004 seconds on 14 queries.