|
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
|
|
|
|
|
It certainly would be possible. How difficult would depend on your programming knowledge and on the specification for the simulation. Have you done any Java or C++? If not then it'll be a fairly large task.
Michael ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hi! I have such problem. It is necessary to update a part of page on the client (value of several ASP functions) by the timer. Updating all page is extremely undesirable. Could anybody give me good advice?
|
|
|
|
|
You could use a DIV tag and change the inner HTML. in JavaScript:
document.all.tagName.innerhtml = "Some HTML";
Josh Koppang
|
|
|
|
|
faq forum java string tokenizer improve separator consecutive delimiter parse
java string tokenizer improve separator consecutive delimiter comma substring enhance whitespace preceding count parses parser side-by-side null returned between
String Tokenizer Java 1.1 improved
==================================
by modifying Tokenizer from JDK 1.31 to run under JAVA 1.18
Interface Iterator and following function removed:
public void remove()
{
throw new UnsupportedOperationException();
}
OPAT Atraxis/EDS, opat@atraxis.com / opat@eds.com M.Noerlinger A.Kienast
Greetings
Andrew
|
|
|
|
|
I'm trying to set up a fairly sophisticated user interface from an applet running under Internet Explorer 5+ (without the java plugin).
javax.swing.* appears to be unavailable so I've been working with
com.ms.ui.*
Trouble is I've found no documentation for these classes beyond the bare definitions I get from J++ and few examples. I'm working largely by trial and error.
I'd like to put a file and directory selection window on the applet form (rather than using the FileDialog). (Yes, it's a signed applet).
Has anyone located any documentation for this stuff? This is an extremely frustrating way to work.
|
|
|
|
|
The MSDN library that you can buy, or it comes with Visual Studio has massive amounts of documentation. It isn't free, however. It may be worth it if it allows you to do it much faster. Try Microsoft Developer Network to see if there is anything on there
Josh Koppang
|
|
|
|
|
Hello,
I am very new to java.
I want to call a C-dll function from my java code and I don't know how. Can you please help?
Thanks.
Where there is a WISH, there is a WILL.
|
|
|
|
|
There are facilities for this kind of thing in the MS version of the java engine. It's documented on the microsoft java site. Basically microsoft have put in some naughty java extensions for this purpose.
You do things like
<br />
<br />
static native int MessageBox(int hwndOwner, String text, String title, int style);<br />
(This must be in a class definition, of course).
I rather doubt there are any facilities to do this kind of thing in the Sun java engine. It's too machine dependant.
|
|
|
|
|
Malcolm McMahon wrote:
I rather doubt there are any facilities to do this kind of thing in the Sun java engine. It's too machine dependant.
Yes, there is. It's called Java Native Interface.
|
|
|
|
|
That doesn't look like it would allow you to access an existing DLL though. Only one specially written for this purpose. Of course you could write an interface from there to a standard DLL.
|
|
|
|
|
That's right.
I found JNI but it sounds like it is very slow.
And you can't use existing dll.
1.You write the native methods declaration in a java class
2.Then you compile the java class (javac)
3.Generate a header file from this class using javah -jni ...
4.include this header in you dll project and provide and implementation for the generated header functions.
5.Rebuild your dll
From this point, you can use the dll via the java class methods we wrote at step 1.
I tried using JNI. It works because I could change the source of the dll and I wanted to use. But it is surprisingly slow. Now I am looking forward to using sockets.
Thank you.
Where there is a WISH, there is a WILL.
|
|
|
|