masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why not simply use the vector (or an ArrayList if it does need to be synchronized at that point) and then call toArray on that Vector/List?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This

S = (1/2) * perimeter;

should be

S = (1/2.0) * perimeter;

(or something similar), otherwise (1/2) is integer math and produces 0, which makes S 0.
(or simply S = 0.5 * perimeter; or S = perimeter/2;)

I would also "predetermine" the value of (180/Math.PI) rather than actually doing that operation in each method. Also, angle1 and angle2 are both using the same formula (i.e. both determining angle1). One of those should be ab2 + bc2 (with the other approriate changes) as that is the one that is not calculated. Other than that the formula is correctly implemented.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

As long as an element is visible it cannot be disposed. You would have to hide (setVisible(false)) that frame before you can dispose.

I don't agree with much of what you're doing here though, to tell you the truth. I find extending frmae to be a bad idea. I would build the things as a composite on a JPanel and have a separate control class that creates a Frame and simply swaps out the contentPane with the proper JPanel at the proper time.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's been a while since I've done any real scripting but shouldn't

if [ ! -z "$remove_old" || $n_backups -ge $MAX_BACKUPS ]; then

be

if [ ! -z "$remove_old" -o $n_backups -ge $MAX_BACKUPS ]; then
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Oh, upset that nobody did your work for you? Too bad.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. We don't do things that way here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No. You have to do the math again. The variables are simple primitives not Closures.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nothing to do with JSP. Either you need to send all possibilites for the "destination" menu and use JavaScript to "filter" those according to the first choice, or you have to learn how to use AJAX (or something similar) properly. Or, of course, you can let the entire page be reloaded (I don't see the real problem with that). In any case, it has nothing to do with Java/JSP.

Edit: Moving to another forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then you can't. Maybe using Runtime.exec/ProcessBuilder to run some external command, but that's a brain-dead platform dependent hack.

And, if the instructor is truely saying that you must develop and execute from an IDE then he is doing the class an injustice. You will not learn the language and everything that goes into properly if you never learn how to compile, execute, package, deploy, manipulate the classpath, and make adjustments to the JVM from the command line. You will simply become a code-monkey that becomes almost useless as soon as you don't have that IDE in front of you.

The only other way is to use a Swing GUI and not a command line and the JPasswordField.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Run it from the command line. After all, are you planning on deploying the IDE along with the application?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try using the Console class rather than Scanner.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By creating an appropriate constructor in the "Purse" class.

I.E

public Bogus(Bogus bogus) {
    someValue = bogus.someValue;
    someOtherValue = bogus.someOtherValue;
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Finished.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This Product product = ProductIO.getProduct(productCode, path); probably returned null. Put in some debug output to check the values of productCode, path, and product.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

How have you determined that it is "being ignored"? Put a print statement in there to see. Also, you do know that after the first iteration both x0 and xn have the same value, meaning that in the second iteration 0 is not greater than .0001 and the loop exits, right? I assume that you should be refiguring the xn value after assigning xn to x0, no?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Seemingly it would have to be an Integer array, not an int array, although it would probably help to know exactly what "namestimesSet" is, I'm assuming a Set<Integer>.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By typing in a text editor.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

With a text editor.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

P.S., judging by all the problems, I can only assume that you got the original code here from somewhere else as well, as many of the problems listed above are real beginner things that you should be far past, judging by the rest of the code. And you see how you are sturggling with this? That's because you haven't been doing your own homework.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The list should be an instance variable. Secondly this part

ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0;i!=questions.length;i++) {
    Arraylist=questions[i];
}

you only want to do once, not with every call to getRandomQuestion

Thirdly, use i < questions.length.

Fourthly, when adding the items to the arraylist use the Add method (see the API docs).

Fifthly, You only want to store "i" in the ArrayList, not "questions[i]".

Sixthly this Random r = new Random(); should also only be done once (not with every call) and r should also be an instance variable.

Seventhly, store the result of "list.get(i)" (no need for the cast), and then return that at the end of the method.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am waiting on your attempt at implementing my last advice.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am helping you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And how would you learn anything if I did your work? You are in the course to learn something, not just to hand in finished work that you don't understand. It may facilityte a passing grade today, but tomorrows lesson, which will build off of todays, is that much harder.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I don't see anything to do with ArrayList there so I guess you don't want to follow my advice.

The other thing is, and an int parameter to your "getRandomQuestion" method to use as the index into the history array, both for the assignment and the check that you are doing in that method.

Also, using an array, you are going to have to check all indexes of the history array from 0 to the passed in parameter to make sure it differs from the number you just generated. Which means, of course, that the more numbers you've generated the longer it will take to generate a "unique" one. Using the ArrayList will avoid this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Show your complete code and provide all error/compiler messages (complete stack traces) and describe (briefly but completely) the difference between the expected and the actual output.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

IOW can I do it for you? No.

Create a list of Integers with

ArrayList<Integer> someVarName = new ArrayList<Integer>()

Then, for each item in your "question" array" add it's index as an Integer to that arraylist

Get a random number with

Random r = new Random();  // as an instance variable
...
int someIndex = r.nextInt(someVarName.size())

Then retreive the Integer at "someIndex" from the ArrayList with the get(int) method, then remove that "someIndex" from the list with remove(int). The Integer you retreived from the list is your index into questions and answers array.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
// the code
a * b * c;

That is as much cut-n-paste code as you are going to get.

Post what you have, all error/compiler messages it produces, and/or the difference between the actual and expected output, and we will help you correct your code, but we are not going to do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Create a List of Integers (which are the indexes to your questions) and use the random class to produce an int from zero to list.size() then get the Integer at that index from the list (and delete it) and then index into your question array using this Integer. Once the list is empty, recreate it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Sure, we're happy to help, let's see what you have.

IOW we will not do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I would say to ask the "drools" project.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No they don't. Those files won't actually be created until you open a FileWriter, FileOutputStream, etc, with them. "new File(String)" does not physically create a file on the file system.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Call doLayout() on the contentPane of the Frame, and then repaint() (just to be sure).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You might also be able to use Derby/JavaDB also in a read-only mode, but I'm not sure, just to keep your options open.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you mean that the DB data is to be stored on the CD, not AFAIK. If you mean only the software for the DB check out JavaDB (embedded usage).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you have created a small C program using Java. Do not simply put everything in the main method. You need to essentially throw this away and start again. Create a class that holds the varying pieces of information as instance variables and that defines methods to do those operations above.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? And what part of this is giving you problems? Where is your code? We are not going to write it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Closing this zombie. There is a "show off your project" forum here.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

:'( you are so rude. Just beacuse I don't understand doesn't mean you turn your back.
I hope I figure it out by myself as soon as possible. Im sorry for distubing you. I'll make sure it wont happen again.

No, I am not rude, I am honest. And, when I tell someone the same thing four or five times (and say it clearly) and they still don't understand (or at least act as if they don't), then I stop telling them as it is not doing either of us any good and is only going to lead to frustation on both parts and bad feelings on their part.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The performance of the GUI (as in it won't freeze while it is querying the DB) yes. Also, I would suggest you create a BufferedImage that contains the entire data and the part that queries the DB simply changes only the parts of the BufferedImage that needs to be changed, and then paintComponent need simply copy the Graphics from the BufferdImage to the Graphics to be drawn in the painting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Again it has nothing to do with quaqua.
See http://download.oracle.com/javase/tutorial/getStarted/index.html

ohh so what you're saying is that i cant do quaqua in java?

No I am not saying that! I am finished talking to the wall now, goodbye!

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So you fetch the data in one thread, store the information (in a queue, a list, whatever) and have that thread (using SwingUtilities) trigger a repaint of the component that reads the data in the saved structure.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You have been told what's causing the error you're getting multiple times and, as yet, it has nothing to do with any of the code just posted. Since you simply can't seem to understand what you're being told I'm going to stop trying to tell you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A "final" variable can only be defined once, and when it is static it needs to be defined at the first reference to the Class. Which means that you won't be able to use a method to set the value of a static final variable. You could use a static block (which gets executed at class load time), but that's not quite the same thing. So, if it is going to be set by a method the variable can be static but it cannot be final, or it can be final (if the method is called by the constructor of the class), but it cannot be static.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Separate your GUI code from your DB code. "paintComponent" should never have anything directly to do with a DB (nor should any other part of a GUI component class).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes it is compiling and there is .class file
This was before i imported quaqua so that's why .class file is there
Anyway, just forget about this quaqua. It keeps giving me that thread exception. It's totally hopeless, won't work.
I guess i've to just use WindowsLookAndFeel.

Thanks for your help, I appreciate it alot

As you've already been told, this has nothing to do with "quaqua". This has to do with the package you've given to your class (which it shouldn't have if that is a package in quaqua, which I can only assume it is), with the way you're defining your classpath, and with the way you are designating your main class, which has already been said.

Uhm, is Account (your class) supposed to be in the package "ch.randelshofer.quaqua"?

If it is, you need to call java from the directory that contains the "ch" directory (from the above package path) and use ch.randelshofer.quaqua.Account on the command line, not just Account.

You seemingly need to re-learn some of the basics (I can only assume you have been "learning" on an IDE, and so know next to nothing about how the JVM actually works).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

With a text editor and a JDK.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

This has nothing to do with "quaqua". It has to do with the fact that you declared that package in your class. If you don't want it in that package (and I'm fairly sure it shouldn't be), don't declare it as being in that package.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, is Account (your class) supposed to be in the package "ch.randelshofer.quaqua"?

If it is, you need to call java from the directory that contains the "ch" directory (from the above package path) and use ch.randelshofer.quaqua.Account on the command line, not just Account.

You seemingly need to re-learn some of the basics (I can only assume you have been "learning" on an IDE, and so know next to nothing about how the JVM actually works).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What exception. Add a printStacktrace to that catch block and post that result.

I have a feeling, though, that's its a "classnotfound". Include the jarfile for that api on the classpath.