stephen84s 550 Nearly a Posting Virtuoso Featured Poster

die dew wed

ride

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Web applications are packaged in a WAR file. If you have a "Web project" which contains servlets, JSPs etc and you would like to deploy it on some remote server using for ex tomcat or glassfish etc using their administrative console, then you need to package it as a WAR (Web Archive).

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Missing the c? What c? I don't see a c in the string. \ is the escape character. If you want a \ to not be interpreted as an escape character, but as a character, use two of them:

Yep the missing "c" was never clear at first, only when I read the post over and over I figured it **seems** like a substitution ciper, where

c = \
A = :
a = Z
t = m
<SPACE> = x .. etc

Hence the problem with the "c".

Amazing work VernonDozier, you hit the nail on the head even though you went in blind.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The classes in the java.util.zip package should be helpful since it (jar) builds on the zip file format.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

like it

day dreaming ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

cut cuts tuck

narrow

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Garfield is just spreading his arms while Bart is raising them.

Will the next person be as crazy ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

588

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

As usual you should start from the source i. e. Maven Site.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Also I would like to suggest to please put your code inside [code=java] and [/code] tags

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

So post your code so we know what the heck you are talking about.

And if you do not know the basic concepts of object oriented programming or Java for that matter, what are you doing writing applications with them ???

First learn the concepts of the language, the methodology of OOP so that you have a strong foundation and then use the "learn as you go" approach with the rest of the cosmetic stuff (Collections API, etc).

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The idea BestJewSinceJC recommended is pretty good too, just add an extra "nextLine()" after your "nextDouble()" calls and your files should be read with no problem at all.

However to read the file in the second format you have mentioned, I suggest setting the delimitter in your Scanner to the new line character and use the next() method to read the text from the file.
You can check the javadocs of the Scanner class here on how to change your delimiter.
Also you will need some help regular expressions which you can get here.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

HTI

Tracing Errors ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

till tile let

lioness

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

And why do you think posting your question twice on two separate threads would help you get an answer faster, especially considering that you haven't even made an effort to spell check your code.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

584

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

My Suggestion would be the reverse of what you have opted for now, use nextLine() for all your tokens, inclusive of the double values.
You can use Double.parseDouble() to get the corresponsing double value from the String that is returned from nextLine().

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I guess all braniacs were/are crazy to some degree.

Am I crazy to think that ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

580

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1146

Just keep counting backwards

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

574

Seems like we will have to give some alphabets on loan to the opposite Team to make this contest interesting ;-)

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This should help you start up.
But if you haven't worked with interfaces then you must be just starting Java Programming, I would suggest you rather implement your own PrioritQueue backed with a LinkedList rather than let the Java collections library spoil you.
That way you will develop your logical thinking ability, however in the real world projects (production systems / live projects) when you are thorough with the concepts of Java you should use collections instead of implementing on your own.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now what I am **guessing** is the following chunk of code could have caused the problem:-

flyingSpeed = reader.nextDouble();
System.out.println(flyingSpeed);
airWeapon= reader.nextLine();

Now before the first line is called I guess the scanner is at this point in the file:-

150.00
^
Missle
Killer 571
U571
10000
500
Missle

When we read the double from the file, the we move to the end of the current line as here:-

150.00
      ^
Missle
Killer 571
U571
10000
500
Missle

After that when nextLine() is called the scanner returns whatever it finds on the current line (between the current position and the end of line) which is nothing so it just returns a blank string.
Hence the subsequent System.out.println(airWeapon); just prints a blank line.
Now at the begining of the next loop the following is the position on the Scanner in your file:-

150.00
Missle
^
Killer 571
U571
10000
500
Missle

Now when you robotName = reader.nextLine(); , you actually read the "Missle" and not "Killer 571" as you wanted to, however this wouldn't cause a problem since both are Strings. The same also happens with serial = reader.nextLine(); , it actually reads the robot name "Killer 571" instead of "U571" but that too as fine as both are Strings.

Now when you try to read the "price" the problem arrives. You expect a double value but ... you Scanner is currently pointed on "U571". Because of which you get an InputMismatchException indicating that …

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I wish I had a clue about that.

are chimpanzees fun to hang out with ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1142

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

ban bad mad

brisk

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

564

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Please refrain from using chat speak, it does not sound professional and also is against the forum rules.

Have you added the mapping to that specific Servlet in the deployment descriptor (web.xml). Also where have you placed the class files. I hope you have followed the standard approach in web applications.

You can check out this simple tutorial here which covers all those points.

Also I hope you at least have a working installation of Tomcat on your system.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The above would work however Arrays.sort(cities); would sort the City objects by their natural ordering as quoted in the Javadocs and not as per the "population" of those individual objects.

So he would still have to either implement the Comparable interface in his City class so that the natural ordering is done as per the population field or he would have implement his own Comparator and use this variant of the sort() method.

Also the O.P would have to do the same using the PriorityQueue in the "util" package too.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

pot stop top

frost

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

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 550 Nearly a Posting Virtuoso Featured Poster

-1140

Nope it will never

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

To understand the following suggestion or enhance it even you will need some knowledge of HTML forms. So here we go:-
In your index.jsp create an HTML form with an input field (it could be hiddent or a text field) named "hello" and another "Submit" button for that form. Also set the "action" field of that form to the same index.jsp.
Alternatively you could also simulate a HTTP GET request by using the anchor element (<a> tag). for example "http://...../sample.jsp?user=cdf" is equivalent to a form with an input element "user" being posted to file "sample.jsp"using the "HTTP GET" method.

Next in your JSP section check for the occurrence of the parameter named "hello", using request.getParameter("hello"); .
If you get any value for this other than a "null", that would mean you have been directed to this page, after you clicked the submit button on your form.
So in case you do not get the "null" just print "Hello" or any other text you wish using a normal "if" check.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

@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.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Like it

Daniwebbing ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Being called a bore just for following the rules thats wrong !!!

Are you a bore ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

let lobe bet

tiger

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

560

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

HTI


Formatting your PC(s) ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

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.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The data structure that would fit the bill here appears to be a priority queue (with population determining the priority).
You could either implement it by hand yourself or use the implementation that comes in the "util" package.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

For me here it seems you have two options:-
First is shift the code where you are taking input of the "radius" and "color" from the user using the Scanner directly into the "Driver" class and pass those corresponding values to the Circle class.

Second option is modify the "Driver" class constructor to take the circle's "color" and "radius" as arguments and then pass those values to the "Circle" class's constructor.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Lets see, what happens !

Is it allowed to be repeated ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Eating an apple a day keeps the doctor away. (Modified to follow the rules ;-))

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Septic set pet


great

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

556

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

550

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

546

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

540

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

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