masijade 1,351 Industrious Poster Team Colleague Featured Poster

For one you are trying to declare something inside the main method. That doesn't work. For a second thing, what is it? if it is a class, add that keyword, and put it in another java file, of course, if it is a method, then declare the return type.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Closing this zombie now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nothing, except determine whether or not the string matches. Since you are not evaluating that boolean result, it does not do anything. One "side-effect", of course, is the capture group (remember, the "remembered text"). That is also usable after the regex line, as in that "$1" you see later.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

determining whether the "current" line fits that pattern. I don't know what you understand by "matching", but that is what it means.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
$abc =~ /^           # Beginning of line
         [^\d]{2,4}  # 2 to 4 characters as long as they are not numbers
         <           # a literal less than sign
         ([^>]+)     # at least one and all characters except (essentially until) a
                     # greater than sign.  This text will be remembered.
                     # The parens do that.
         >           # a literal greater than sign
         \d?         # a number is allowed, but doesn't have to be found
         \1          # the "remembered" text 
         $           # end of string

just "matching" not changing anything.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you are doing this completely wrong. From front to end. See the links I gave you in your other thread.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Don't use scriptlets in JSP and use a Connection Pool. And you can't use a "sendRedirect" in the middle of a page anyway. A sendRedirect needs to be the entire page.

Also, form-based authentication is normally handled by the web container itself, you, normally, need only provide an html form and the connection information to the user realm.

See this and this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As soon as the first combobox loses focus (and the selected/entered value has changed) repopulate the second combobox (don't figure to disable it while doing so).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Package it as a jarfile.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That is not a JSP question, technically, and this is the wrong forum for a JSP question, anyway, there is a JSP forum, that is an HTML question. The real question is, why would you want a form without an action? What purpose would it serve? That is just some food for thought. My advice would be to find an HTML forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry but :sigh: why not just salary *= (1.0 + byPercent) if "byPercent" is already in 0.1 format salary *= (1.0 + (byPercent/100.0)) if not.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, a FocusListener?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm arrayName[5]?

arrayName[index] = whatever ?

whatever = arrayName[index] ?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

While needs a boolean.

while((ch = f.read()) != -1)

Now, you look at the API docs and/or the Java IO Tutorials and tell me what that line is now doing and how it is different from yours.

Edit: And format your code!

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Just simply save the Student in the same index of the array as the StudentsID is. Regardless of whuich was assigned first. And, since the Student exists in the array at the index that matches the StudentID, and it is StudentID you need to "search" on, you simply retreive that index from the array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First of all, properly format your code. How do you expect anyone to read that?

Not to mention that that what you have will not compile, at all, since this

{ NIIT Developing Object Based Applications in Java Assignment A.9

is definately invalid code.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All of the information that pertains to a "Student" is a separate class "Student", and you store the information in a Student[], of course, and the "StudentID" would then be the array index.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So what problems are you having with it? BTW we are not just going to give you any "missing" pieces.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Creaate class that extends JPanel and override the paintComponent method to draw the image.

Edit: Of course, it would help to know exactly what the problem is that you're having with it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

For the "Operation Not Allowed" error, if you would take the time to look at the API docs, you would see that whenever you execute a query using a Statement object all currently opened ResultSets associated with (i.e. created using) that Statement object will be automatically closed. Use a separate statement object for any additional queries you wish to do while still using the ResultSet of another.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi, I have some additional information.

private void calculateOperation()
    {
        ControllerNewYork controller = new ControllerNewYork();
        ResultSet res = controller.connectTwo(txtName.getText());
        
       String st = res.toString();
        
        System.out.println(st);

The print I get to console is

com.mysql.jdbc.JDBC4ResultSet@18a992f

What is this?

Thank You.

You do not call toString on a ResultSet. What that is the classname and the Hash Address for the object (I.E. the result of Object's toString method).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do not cobble together SQL statements like this. See the API docs and the JDBC tutorials for PreparedStatement.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You still haven't changed anything. And don't start yet another thread on this topic.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So what is your problem now (other than the fact that you have "copped out" and gone with null layout)? You are not even making an attempt at setting any background color.

As I said, simply setBackground and setOpaque.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

:sigh: Closing this zombie now.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So what is it you want to raise by 10%?

That is what you should be multiplying against (and assigning back to of course)
i.e. x = x* y or x *= y

Now, as to the number you should be multiplying with. As I said before, if you multiply with 10% (as 0.1 is) you will end up with only 10% of the salary. That's not what you want. You want to raise it by 10%, for that you still need the original 100%, so you need to multiply by 110%. Now, if 10% is 0.1 what is 110%?

Now, attempt to change the method and post that back here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well 10% of anything is only 10%. If you want to raise something by 10% then you want the end product to 110% of the original. Now, using that hint, what do you want to modify and what should you multiply that by.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, a lot of good it did to ask the OP those questions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

first you want \. not .
second you don't need capture group parens around the parens
third, what you are missing is the replacement string, which would simply be - and the first capture group, of course (since there should only be one capture group).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That also does nothing other than read bytes and interpret them as characters (i.e. text files and text files only). If the data is not being saved as simple text written using a filewriter (or fileoutputstream), but rather as a data or object outputstream you won't be able to use that.

Since the OP doesn't feel the need to tell us exactly what the .dat file consists of (he has told us the "data" that may be in it, but not how that is represented in the file) I no longer fell the need to help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Actually if Java 7 ever comes out, you can then use Strings in switches. You can, also, ever since they have existed, use Enums in switches.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A .dat file is perfectly fine. .dat files can take the same things as .txt files, therefore it can take strings, ints, etc.

Yes it can, but that's not quite the point. The point is that how it is written will greatly affect, of course, how it is to be read.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does the method signature

public int getorder()

mean? And does the method actually fulfill that contract?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As I said, it is "generally" OO, but it doesn't even come close to the "common sense" interpretation of "pure" OO. Again, hard to do that with primitives.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why not? Does your instructor consider you incapable of reading the API docs for String?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Call toUpperCase() on the string assigning the result back to the original string.
Call split("\\s+") on that String assigning the result to a new String[]
On each element of that array call trim() assigning the result back into the same element of the array.
Call charAt(0) on each element of the array to retreive the acronym characters.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Call split("\\s+") on the string that results from calling toUpperCase(). Then, on each element of that resulting array, call charAt(0) on the result of calling trim() on that element.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, setBackground(Color)? Don't forget to call setOpaque(true) on most components, however.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So how are you saving that? With a RandomAccessFile? A DataOutputStream? An ObjectOutputStream? A FileWriter?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What is the ".dat" file? That extension doesn't really mean anything and many programs store many different types of things using that extension in many different formats. If know what is saved, and, more importantly, how it is saved, we could give you a better answer. P.S. A BufferedReader will only work "properly" for text files.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

FYI, this thread has already been marked solved, so I can only assume he had already figured out the answer (or had cross-posted on other forums so that we would waste our time answering), but the OP should have the decency to post the answer (not necessarily the "new" code involved, a description would be enough) so that others with the same problem would need to ask the same question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

if you want to display the buck object, you would do this:

System.out.println(buck.toString());

Actually, it is unnecessary to call toString in a print statement. The print statements (print and println, not sure about printf, though, I should probably look into that) as those methods automatically use String.valueOf(argument), which, for Objects, turns arund and calls toString() on that Object, itself. ;-)

Edit: He is getting the output he is getting because he hasn't defined his own toString() method, and so Object's toString() method is being used, which produces the output you see. (P.S. this line was more for the OPs benefit, as I am fairly sure you know this already. ;-) )

masijade 1,351 Industrious Poster Team Colleague Featured Poster

P.S. It might, in the future, help to describe "don't work" precisely, as that is the singularly most useless problem description in the world.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, rather than simply googling for finished code, you should be reading tutorials and the API docs. See the API docs for URLConnection for info on how to get the headers, and there is a link in there to follow that will give you information about headers in general. Do a little reading and you should be able to figure it out.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am happy to pass on my knowledge (as pitious as it is), I just don't like doing other's work for them. ;-)

Edit: And I expect a bit of effort. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As I said, I had to do research, specifically on the charAt feature. It’s like a substring, and can be use to target a specific character in a string, and only that one character in the string; in this case since a variable is used it targets the character in the string based on the current value of the variable, which is based on the iteration of the for-loop.

In the first pass, the variable is equal to 0, therefore (i) is equal to
0, which points to the first character in the string. Given the input name of Jason, then (i) points to the (J) only for the myName.charAt(i) code.

Correct, charAt(0) points to the first letter (Strings are "zero-indexed", as are all arrays in Java, and a String is, essentially a char array. "zero-indexed" means the index of the first position is 0, some languages are "one-indexed").

It will then examine the myName.substring(0, i) code, and since the variable is 0, the substring method is (0, 0). Here, the static (0) should now capture the (J) and nothing else, and the variable (0) captures spaces, but it looks to me only spaces are captured for this pass. I don’t quite understand this.

Not quite, almost though. the two substring arguments are, respectively, inclusive, exclusive. That means the first argument is the actual index of the first character to be "read". The second argument is the index after the last character to be read. This means that substring(0,i) …

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First, there is no "official" (perceive that as IEEE) definition of "pure" OO. Yes, generally Java is definately OO. It definately does not, however adhere to even the "generally accepted" definition "Pure" OO, however. It's kind of hard to do that when you can use primitives.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
javac -cp . sms/*.java
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Did you move the source files into a subdirectory of the current directory called sms? if not (and you do not necessarily, have to) then you do not need to use sms/SMSClient.java, but rather still, simply, SMSClient.java by compilation a sms subdirectory will be created (if it doesn't eixst, and the classfiles will be found there, and the execute command will then be

java -cp . sms.SMSClient
masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. I meant to give your classes a package. Any package. The first code line in your code should be "package whatever.package.name.you.want;" If you do not have that the classes are in the "default" (i.e. no package) package and there are problems including classes from that package (which the smaller class is attempting to do and is probably the reason for the "cannot be resolved". Now I really have a beef with schools (if that is where you are "learning"). They always have students start out in the "default" package and then, as soons as they try anything else, this sort of thing starts to happen and they have no clue what is happening (not to mention the fact that they have them using IDEs and so the students no nothing about the classpath, the second part of this problem), they should learn packages (at least this part of it) as one of the first things. As far as the classpath goes, also, no. I assume you have both of these classes in the same place? In that case

java -cp . callSMSClient

As I said, use "-cp . ".