|
Java. So what?
Java is a sunny island whre nobody expects to find us... oh, of course, Java apps run on windows, so the Java forum is not really misplaced on CP.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Corinna John wrote:
so the Java forum is not really misplaced on CP
Yeah, it isn't misplaced. It is hidden.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Why should the hidden forum be only for Java?
Let's make it a place for topics we cannot discuss in the public...
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Like what? the burning sensation on my ringpiece......?
|
|
|
|
|
Topic of the day: How do people still find this place?
____________________________________
There is no proof for this sentence.
|
|
|
|
|
...abandoned though it may be.
Hrm... Go get Java 1.5...
You're one microscopic cog
in his catastrophic plan...
|
|
|
|
|
Wanna repopulate this board? Just the two of us.
Wait, that didn't come out right.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
|
Nick Seng wrote: Wait, that didn't come out right.
I'll say. LMAO!
Jeremy Falcon
|
|
|
|
|
HEY THERE, JUST NEED SOME HELP ON MAKIN FORUMS IN JAVASCRIPT. CAN SOMEONE PLEASE HELP ME IN POINTING ME IN THE RIGHT DIRECTION OR GIVE ME SOME CODE TO HELP ME OUT. gREATLY APPRECIATED
|
|
|
|
|
I am currently taking a basic Java class in school. We havea project this week where we have to create a "simple choice" program where uses can follow a story by answering yes or no to given questions. I got it working as required (we are limited to use only the basic if/else statements in our Chapter 2 readings). The only thing that I think I may have wrong is that in the requirements, the instructor states that any answer that isn't yes is to be assumed no. My problem is that this is not true in my project as I have both and -if yes- and -if no- statement defined. If I don't specify the -if no-, statement then the story will read fine, but instead of ending at the specified points, it continues to read and execute all the other "else" statements that aren't specified to occur only if the answer is "no".
Below is my code. I know it's hard to understand what I just wrote. I am new to this and can't explain this well. Any advice would be appreciated. I am thinking...is there a easy way to say something to the affect:
else
if (gotoplaza.equals("no" OR "anything else"))
{out.writeln("my text here");
Again...thanks for any advice!
-Alysen
class alysen_2 extends basic
{ public static void main(String param[]) throws Exception
{ input in = new input();
output out = new output();
String turnright = "";
String gotoplaza = "";
String getgasoline = "";
String gasstationfood = "";
String mcdonalds = "";
String wendys = "";
String shop = "";
//initial question
out.writeln();
out.writeln("It is a nice spring day and you decide to go for a drive");
out.writeln("just to get out of the house. You jump in your car and start");
out.writeln("to drive down the street.");
out.writeln();
out.writeln("You come to the end of the road you live on and come to a stop sign.");
out.writeln();
out.writeln("Do you want to turn right?");
out.writeln();
turnright = in.readline();
//tier 1 :: turn right ::: CONTINUE
if (turnright.equals("yes"))
{out.writeln();
out.writeln("You have chosen to go right");
out.writeln("You continue to proceed right down the street.");
out.writeln("You see a shopping plaza on your left.");
out.writeln();
out.writeln("Do you glance over to see what stores are there?");
out.writeln();
gotoplaza = in.readline();}
//tier 2 ::: stop at plaza = yes ::: CONTINUE
if (gotoplaza.equals("yes"))
{out.writeln();
out.writeln("You pull into the shopping plaza parking lot.");
out.writeln("You remember that you need new shoes and some milk.");
out.writeln("Luckily there is a shoe store and a grocery store in the plaza!");
out.writeln();
out.writeln("Do you want to go shopping now?");
out.writeln();
shop = in.readline();}
//tier 2 ::: stop at plaza = no :::END
else
if (gotoplaza.equals("no"))
{out.writeln();
out.writeln("You don't want to go shopping?!?!?! Then go home!");}
//***BEGIN ADDITIONAL TEXT***
//tier 3 ::: shop = yes :::CONTINUE
if (shop.equals("yes"))
{out.writeln();
out.writeln("You don't see any shoes that you like, so you decide");
out.writeln("that you can get shoes later. You buy some milk and ");
out.writeln("head on home before the milk spoils.");}
//tier 3 ::: shop = no :::END
else
if (shop.equals("no"))
{out.writeln();
out.writeln("You decide that you don't want to go shopping now.");
out.writeln("You start to think it is dumb to aimlessly drive around");
out.writeln("like this so you decide to go home!");}
//***END ADDITIONAL TEXT***
//tier 1 ::: don't turn right
if (turnright.equals("no"))
{out.writeln();
out.writeln("If you don't want to go right, you must turn left.");
out.writeln("You continue left down the busy street.");
out.writeln("You discover that you need gas.");
out.writeln();
out.writeln("You see a gas station. Do you want to get gas?");
out.writeln();
getgasoline = in.readline();}
//tier 2 ::: stop to get gas ::: CONTINUE
if (getgasoline.equals("yes"))
{out.writeln();
out.writeln("You pull into the gas station.");
out.writeln("You fill up your tank. You are hungry so you decide to");
out.writeln("go into the gas station market to check out what snacks they have.");
out.writeln();
out.writeln("Do you get something to eat?");
out.writeln();
gasstationfood = in.readline();}
//tier 2 ::: don't stop to get gas ::: END
else
if (getgasoline.equals("no"))
{out.writeln();
out.writeln("You should have gotten gas. You run out of gas and are stranded on the highway.");}
//***BEGIN FAKE CHOICE***
//tier 3 ::: get gas station food ::: CONTINUE
if (gasstationfood.equals("yes"))
{out.writeln();
out.writeln("You go inside the gas station market.");
out.writeln("You buy a candy bar and go back to your car.");
out.writeln("You continue to drive down the street.");
out.writeln();
out.writeln("Suddenly, another car pulls out in front of you!");
out.writeln();
out.writeln("Do you swerve out of the way of the car?");
in.readline();
out.writeln();
out.writeln("You can't avoid the car that just pulled out in front of you.");
out.writeln("You slam into the other car. You pull over to side of the road.");}
//***END FAKE CHOICE***
//tier 3 ::: don't get gas station food ::: CONTINUE
else
if (gasstationfood.equals("no"))
{out.writeln();
out.writeln("You decide you would rather not eat any snacks from the gas station");
out.writeln("and would rather stop somewhere else to eat.");
out.writeln();
out.writeln("Do you want to stop at McDonalds?");
out.writeln();
mcdonalds = in.readline();}
//tier 4 ::: get mcdonalds ::: END
if (mcdonalds.equals("yes"))
{out.writeln();
out.writeln("You decide to pull over to the McDonalds down the street and eat a Big Mac.");
out.writeln("You decide to settle in at the local McDonalds for the rest of the evening.");}
//tier 4 ::: don't get mcdonalds ::: CONTINUE
else
if (mcdonalds.equals("no"))
{out.writeln();
out.writeln("How about Wendy's? Do you want to stop to eat at Wendy's?");
out.writeln();
wendys = in.readline();}
//tier 5 ::: get wendy's ::: END
if (wendys.equals("yes"))
{out.writeln();
out.writeln("You decide to pull over to the Wendy's down the street and eat a Hamburger.");
out.writeln("You decide to settle in at the local Wendy's for the rest of the evening.");}
//tier 5 ::: don't get wendy's ::: END
else
if (wendys.equals("no"))
{out.writeln();
out.writeln("Since you can't decide where to eat, you just pull over at 7-11");
out.writeln("You buy a hotdog and head on home.");}
//***CONT. FAKE CHOICE***
out.writeln();
out.writeln("Your adventure is over.");
out.writeln();
out.writeln();
//***END FAKE CHOICE***
in.close(); out.close();
}
}
|
|
|
|
|
In the specified if statement do this:
if("yes"){
//execute code
}else{
//execute no code
}
this way if its a yes then the first statement will execute and if its anything other than yes it will run the no code.
hope this helps
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
Hey, look at the date of the thread you're answering. The month is April yes, but the year is 2002!
I guess the guy could have gone and take a Java certificate by now
It looks like you, Corinna and me is about to start up the Java Forum again
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
-- I didnt even notice it.
Yeah it would be nice to have some place to go for my java questions. I havent found to many good java message boards. Now if they just wouldnt hide us like the step brother they never wanted
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
I while ago I created an Java application that seemed to work fine at commandline. However, when I turned it into an applet I get a ClassNotFoundException for java.util.HashMap. Does anyone know what that is about?
Anyway, if you want to look at the code (it is eventually supposed to be a framework for building zork-like games) you can find it here. Commandline: zork.class, applet as in the webpage submitted.
Thanks
/moliate
|
|
|
|
|
I guess it's a Java 2 class, and the builtin JVM in MSIE understands only Java 1. Have you installed Sun's Java plugin or tried appletviewer.exe.
|
|
|
|
|
You are right, HashMap is Java2. I was so sure it was Java1...
Thanks for the help
/moliate
|
|
|
|
|
Hello,
I am having a problem with the precision of some of my calculations. The example below is about calculating a field called basicAdjustedSalary.
BasicAdjustedSalary = 1.06*currentSalary + 2550.00 * age + (yrsOnteam/yrsInLg) *145924.75
Here is a quick example of the issue I am seeing
Current Salary = 4253628.5
Salary Multi = 1.06
Salary Multi * Curr Salary = 4508846.0
*** Incorrect should be 4508846.21
I have all the fields involved defined as float type. I don’t understand why I am not getting the correct result.
Thanks,
Paul
I don’t know if it will be helpful, but here is the code section and the output from the println statements:
** OUTPUT **
Current Salary = 4253628.5
Salary Multi = 1.06
Salary Multi * Curr Salary = 4508846.0
*** Incorrect should be 4508846.21
Age = 34
Age Multi= 2550.0
Age Multi * Age = 86700.0
*** Correct
Yrs on Team / Years in Lg = 0.6666667
Loyalty Multi = 145924.75
(Yrs on Team / Years in Lg) * Loy multi = 97283.17
*** Correct
Basic Adjusted = 4692829.0
*** Incorrect should be 4692829.38
*** CODE ***
//*************************
//Name: calcBasicAdjustedSalary
//Purpose: calculate the basic adjusted salary
//Accepts: void
//Returns: float value representing the basicAdjustedSalary
//*************************
public void calcBasicAdjustedSalary()
{
//Use constants defined in the BaseballTeam class to calculate the
// appropriate value
basicAdjustedSalary = (BaseballTeam.SALARY_MULTI * currentSalary) +
(BaseballTeam.AGE_MULTI * age) + (((float)yearsOnTeam/yearsInLeague) * BaseballTeam.LOYALTY_MULTI);
System.out.println("\nCurrent Salary = " + currentSalary);
System.out.println("Salary Multi = " + BaseballTeam.SALARY_MULTI);
System.out.println("Salary Multi * Curr Salary = " +
BaseballTeam.SALARY_MULTI * currentSalary );
System.out.println("*** Incorrect should be 4508846.21\n");
System.out.println("Age = " + age);
System.out.println("Age Multi = " + BaseballTeam.AGE_MULTI);
System.out.println("Age Multi * Age = " +
(BaseballTeam.AGE_MULTI * age));
System.out.println("*** Correct\n");
System.out.println("Yrs on Team / Years in Lg = " +
((float)yearsOnTeam/yearsInLeague) );
System.out.println("Loyalty Multi = " + BaseballTeam.LOYALTY_MULTI);
System.out.println("(Yrs on Team / Years in Lg) * Loy multi = " +
(((float)yearsOnTeam/yearsInLeague) *BaseballTeam.LOYALTY_MULTI) );
System.out.println("*** Correct\n");
System.out.println("\nBasic Adjusted = " + basicAdjustedSalary);
System.out.println("*** Incorrect should be 4692829.38\n");
}
PC
|
|
|
|
|
The float type is a single-precision floating point number, you are getting the normal precision (about 7 decimal digits) to be expected from single precision calculations. Use the double type if you need more precision, but note that floating point is never absolutely accurate.
|
|
|
|
|
How do I open up a URL connection to a website that requires authentication? I successfully opened up a URL Connection to a site (eg www.bloomberg.com) by creating a URLConnection Object. After opening a connection to the site, I parsed the site to grab some information out of it. I did all this in a Java Bean.
Now, I need to open up a connection to a site that requires a UserID and a password? I have the User ID and password. How do I go about doing this?
Please Help
Thanks
Sanchita
|
|
|
|
|
My application is running on iPlanet6.0 SP2 under platform Solaris 2.8, after about twenty hours, iPlanet will crashed with error "SIGSEGV 11" or "SIGBUS 10", I don't where is the problem, it's the error of my application or the bug of the iPlanet. Any help or suggestion will be appericated, thanks a lot.
|
|
|
|
|
Hi All,
I want to customize the windows common print dialog. I know how to
do this in vc++, but i am not sure how to implement the same functionality
in VJ++.
Any help in this regard would be highly appreciated.
Regards,
Mukesh
|
|
|
|
|
I would like to know how a server can dial in into a remote client using Java? Please help and thank you.
yee fui
|
|
|
|
|
To whom it may concern
My name is Monica Marion and I'm the Producer of the Developer channel for ZDNet Australia (www.zdnet.com.au).
I'm currently looking to expand the channel's focus and direction. Part of this expansion involves an increased level of input from the local developer community and we're looking to get a local Java guru on board to write a regular column for us. So I was wondering if someone you know or yourself would be interested in writing something for us?
Could you please contact me at your earliest convenience on monica.marion@zdnet.com.au
Kind regards
Monica Marion
ZDNet Australia
http://www.zdnet.com.au
monica.marion@zdnet.com.au
|
|
|
|
|
I'm a web programmer who doesn't have that much experience with Java. I'm looking to develop an American Football Simulation web application, and I was wondering if anyone knew if it was possible with Java, and if it IS possible, how complicated would it be?
Thanks for any replies.
jul
|
|
|
|