This is topic I Need Help! Seriously! in forum Ask a Geek! at The Geek Culture Forums!.


To visit this topic, use this URL:
http://www.geekculture.com/cgi-bin/ultimatebb/ultimatebb.cgi?ubb=get_topic;f=12;t=001686

Posted by OhMyGoddessSixx (Member # 3858) on June 10, 2005, 10:06:
 
I've only got a few hours until I have to turn some projects in, and I'm about to rip out my hair.

First, my professor wants us to create a questionnaire as a Java program which scores a estimate for mania ;we have to base it off a quiz he found on a site. I can't figure out for the life of me how to do an estimate program.

Second, he also wants us to create a program that picks a random number for the user to guess.

This number should be in the range of 1 to 100.

The Java function: --sorry couldn't use parentheses

Math.random[]

produces a random value between 0 and 1

double x = Math.random[]

will store a value in x such that 0 < x < 1

n = [int][Math.random[]*100]

will store a value in n such that 0 < n < 1

I can't figure out how to do this either.

Any help would be most appreciated! I am runnning out of time; everything is due today! Thank you in advance!

OMG6
 
Posted by N9IWP (Member # 1229) on June 10, 2005, 12:20:
 
I don't know Java, but your second example should do 0 to 99.

n = [int][Math.random[]*100] + 1;
should get n from 1 to 100 inclusive

I'm unfamilar with "mania" in this context, so I can't help you with the estimate question either.

Brian
 


© 2018 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0