Actually i dont understand why people dont want to show their faces in the forum?
we can take Dani as an example, she is the most preminent one and she does not need to hide her face.
If I am not wrong the cscgal profile does have her picture in it.
Actually i dont understand why people dont want to show their faces in the forum?
we can take Dani as an example, she is the most preminent one and she does not need to hide her face.
If I am not wrong the cscgal profile does have her picture in it.
>might as well be the geek lounge where the rep points wouldn't affect me
Perhaps I should slap you with a Keep It Pleasant infraction. You're not invincible here either, slick. ;)
Damn !!! of all the people in daniweb I pick the only SuperMod for my gloating.
** Puts tail between the legs and runs away **
Amazing. Visiting the Geeks' Lounge is like sitting in a room full of children.
Well we have to vent out our life's frustrations somewhere (or at someone) :P, might as well be the geek lounge where the rep points wouldn't affect me
Naah !!! For a guy who plays tit for tat with Bad Reps his IQ is too low to understand that.
Now because of the ambiguity I just want to mention 'his' = "serkan sendur".
Stop calling him Rashakil fool, maybe he will stop the 'war of words' too!
Naah !!! For a guy who plays tit for tat with Bad Reps his IQ is too low to understand that.
I need to select a file and highlight it without selection
This has gotten me confused, is the second part not contradicting the first ???
Guess what I found a direct API which does this conversion, although I do not know how it works :-
http://www.artofsolving.com/opensource/jodconverter
Please dnt joke .... u r from mumbai?? me tooo.. we can talk on the issue if u dnt mind ... please send the code sample.
You're from Bombay that nice to know, but that does not mean I am going to spoon feed you any code. My first post in the thread links to the iText library and the Apache POI site, go visit them and you will find quite a few code samples there.
can you please help me with sample code that have both apache POI and itext used say for eample reading an excel and converting it into pdf. please hurry ....
Yeah before that transfer a million dollars to my account !!!
i am pretty sure you got that backwards there stephen.
"For example I would enter 12345 and 1 2 3 4 5 would be returned."
I was assuming that is some mistake my the O.P. cause that "split()" method of python too does not operate in that manner but I could be wrong.
Thats the reason why instead of using his first post I quoted his Python post.
Coming from python, to split a string i would do 'string.split(" ")'
and it would split 123 into 1 2 3
I don't know .length, or .charAT, or what that even is
I do not know what I should use to traverse through the string and split it by each space, I know this is simple, but for some reason can't figure it out.
In Java too its just the same thing :-
String alpha = "A B C 1 2 3";
String beta[] = alpha.split(" ");
The values is "beta" would be the following :-
beta[0]="A"
beta[1]="B"
beta[2]="C"
beta[3]="1"
.... I suppose you get the drift.
Just observe the following code snippet:-
if(send = true)
cout <<"You have passed the exam!\n";
else if (send = false)
cout <<"You have failed the exam.\n";
Watch both the conditions carefully you have used only a single "=" instead of "==" to test for equality.
BTW some compilers in this situation would complain of "Possible incorrect assignment".
Also there is no need for passing the second argument "pass" to your grading function, instead just declare a local variable in the "grading()" function and return its value.
I am not sure then what to initialize my String output to. I am lost.
Ehh !!! Its your program you tell me what you wanted to be printed instead of "null" !!!
If you carefully check the following piece of code :-
String output = null;
String menu = null;
Scanner keyboard = new Scanner (System.in);
System.out.print("\nEnter your taxable income amount: $");
do {
taxAmount = keyboard.nextInt( ); // Stores the chosen movie.
validInput = true;
if ( (taxAmount < 50000) ) {
System.out.print ("\n(You must an amount greater than or equal to $50,000): $");
validInput = false;
}
}while(!validInput);
// A method call to displayMenu
displayMenu (menu, validEnter, enter, output);
// A method to call to computeIncometax
computeIncometax (taxAmount, enter, tax1, tax2, tax3, tax4, tax5, tax6, taxfinal1, taxfinal2, taxfinal, alphatax, betatax);
// A method to call to displayFinal
displayFinal (taxAmount, output, taxfinal);
From the start to the end when you call the method displayFinal(). the variable "output" is never initialized (Apart from being initialised to null at declaration time), which is why "null" is getting printed.
String myString = Integer.toString(enter);
return enter;
return output;
You completely missed the point I was trying to say. I had told you to package both those values into a String array and return a reference to that array back to the calling method, like here :-
String[] arrayOfValues = { output, Integer.toString(enter)};
return arrayOfValues;
Also you will have to modify the return type of your method to accommodate that.
BTW didn't the compiler complain about unreachable code ???
Show us what you tried ?
I need both the 'output' and 'enter' to be returned back to the calling method but one is a String and one is an int
You have many options here one is create a new class which has those two as its member properties and return a reference to this object from that method.
Second is put them both inside a "String" array of size "2" and return a reference to that array from the method and in the calling function extract the values from the array. For ex in the method you could have :-
String[] arrayOfValues = { output, Integer.toString(enter)};
And in the caller method you could extract the values from the "String" array as :-
output = arrayOfValues[0];
enter = Integer.parseInt(arrayOfValues[1]);
Next you could also return a Properties (or some other classes part of the Collections Framework ) object with the appropriate name value pairs mapped in it.
Give us more information on what libraries are you trying to use in that applet and what platform are you trying to run this on. I have a strong **feeling** you are not on windows or not using the Sun JRE (of course I could be wrong).
@vishalsnc
Drop the IM speak this is not a chat room, and try to read the rules and search the forums before you post anything.
cn u pls mail me some examples if u have ..
What do you think does the Sticky which Peter has linked to contain ???
nw hw to convert that to MVC2 pattern..
like which files are to be made and hw the content is to be seperated n all..
There is no magic bullet or a step by step guide which you can follow and "Viola !!! your application has been converted to MVC2". Peter has linked you a good example with proper explanations. Think over it and redesign your classes and JSPs with MVC2 and the example as a reference in mind.
If you use the showInputDialog() method, it either returns the String that was entered in the text field or else "NULL" if cancel was pressed, So in case you wish a User to force some input and not press Cancel, you could simple put it in a do-while loop like this:-
String StudentClass = null;
do {
StudentClass = (String)JOptionPane.showInputDialog(null, "What class is " +
"\nthe new student in?", "Info", JOptionPane.PLAIN_MESSAGE,
null, possibilities, "IB Compter Science");
System.out.println(StudentClass);
}while(StudentClass == null);
However if you use showOptionDialog method, and pass the "possibilities" array for the "options", you would get three buttons with their corresponding headings as specified in the Array.
In case you do not want your user to press "Cancel" in a JOptionPane dialog, you can actually get rid of that button altogether using the JOptionPane.showOptionDialog()
<EDIT> Cleaned some of my errors.
From what I see, unlike the rest of the variables (mass, diameter and names which are all arrays) surfaceGravity is just a normal variable.
Hence the following for loop:-
for (int y = 0; y < 9; y++) {
surfaceGravity = (((6.67E-11) * (mass[y])) /(Math.pow(diameter[y] / 2, 2)));
System.out.printf("%25.2f\n", surfaceGravity);
}
Actually does nothing but print the values of surfaceGravity from 0-9.
However the value of surfaceGravity variable are overwritten in the next iteration of the for loop. i.e. for the first iteration your loop calculates and stores the value of surface gravity for the first planet in variable "surfaceGravity", in the second iteration the we calculate the surface gravity for the second planet and store in the variable "surfaceGravity" (as a result the value for the surface gravity for the first planet is lost, overwritten by this new value) this goes on till the nineth planet (which is where the "for" loop terminates hence its value is not overwritten), and hence "surfaceGravity" has the value for only of the nineth planet.
My suggestion from the way your program has been designed is move the call to the "printResults()" method inside the second last "for" loop in your main.
Please avoid chat speak or Sms speak its against the forum rules and doesn't even sound professional.
Also define what you mean by "doesn't work". Give us sample data of the tables and what you want the "SELECT" to actually display.
@stephen84s : Yes but in this case, what happens if he inputs the number of adult tickets to be 110 ? You still ask him for the number of child tickets, which since he has already jumped the maximum count is wrong on our part. If he enters the no. of adult tickets to be greater than 100 he should be warned of the limitation there itself rather than proceeding.
Take a look at this post for a solution.
Yeah thats correct, but I assumed the thread starter will figure out what additional checks to put, so I just pointed out where to put his checks.
The following loop itself could be modified to perform this check you need :-
do {
System.out.print("\nHow many adult tickets? ");
atickets = keyboard.nextInt( );
System.out.print("How many children's tickets? ");
ctickets = keyboard.nextInt( );
positive = true;
// Defines the invalid boundaries (but true by definition).
// add the new condition with an "||" in this "if" condition itself
// or use another if block
if ( (atickets < 0) || (ctickets < 0)) {
System.out.println("\n(You must pick a positive number): ");
positive = false;
}
}while(!positive);
To the "if" condition just add ((atickets+ctickets) > 100) with an "||" operator, so even when the sum of the two is greater than 100 it will prompt the user the enter them again. You will however need to modify your error message to reflect exactly why the user has to input the "aticket" and "cticket" values again taking into account the new case.
Since you are already getting an exception, can you print out the exact StackTrace of what is being thrown up at you. java.lang.NullPointerException
s occur when you are trying to invoke a method/access a property etc on an object reference set to Null.
For e.x. the following code snippet would throw a NullPointerException on the second line.
String alpha=null;
alpha = alpha.substring(1); // Calling a method on an object
// reference set to nul
java -jar "/home/viber/JAVAFINAL/dist/JAVAFINAL.jar"
Now I see the reason for the problem. I am guessing your username is "viber" on your computer and you are running this application is user "viber" and your O.S is Unix/Linux based.
Now when you create the "txt" file what path have you hardcoded in your program ? Does it create the file in the current directory or have you hardcoded the some path inside "/home/viber", eg "/home/viber/sample.txt".
If you have not done the latter the problem is just of simple file permissions on your Linux / Unix box. By default a normal user is not allowed to create or edit files inside the "/", only the "root" user can create/edit/delete any file he wants.
If any other user in Linux wishes to create/edit/delete files in any folder other that his "home", you will need to grant him permissions on the folder explicitly using either the chown,chgrp or by adding that user specifically to some group and allowing that group to access to modify the contents of that folder.
You can learn more about file permissions in Unix here.
Alternatively you could just change your working directory to your "home" i.e. "/home/viber" and execute the JAR file as :-
java -jar JAVAFINAL/dist/JAVAFINAL.jar
Show me some code, on how you are creating your file, also the exact command how you are executing your jar file.
Define what you mean by "can it doesn't work".
Do you have any errors or exception StackTraces to help us go on ?