Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please elaborate. "Many errors" doesn't give anyone much to work with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What is your specific question?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

From your code above, it looks like you're showing the file name in a dialog just before opening

JOptionPane.showMessageDialog(null,outFileNamePDF);

Can you check the read/write permissions on that location?

Netbeans created build and dist folders for the files that it generates. I'm not sure how ownership and permissions are set on those. I've never used Ubuntu in my life, so I couldn't tell you how to check them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you checked the file permission on the location you're showing for 'outFileNamePDF'?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Folder permissions are the likely culprit. Is the exception giving you any more information?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Unless you're allowed to use the Math.floor() function, which seems unlikely, you need to keep only the integer portion of your divisions.

In your case of 32/20, you can't use the 0.608 portion, you can only return 1 bill. You can't round it because then you're giving back too much. You must discard the decimal portion of that calculation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And the reason is that bills and coins are integer quantities - not floats. Treat them as such.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Consider that bills and coins are not fractional. They are whole integers.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can truncate the decimal portion by simply casting the variable to an int

(int)cels

If you want to round, you can use DecimalFormat or the String.format() method.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Agreed. Mine was merely a note on future simplification once he gets the image display issue resolved.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Unrelated note on the code:
These code blocks only seem to vary by the image offset

BufferedImage img = (BufferedImage) Toolkit.getDefaultToolkit().getImage("Images/image.png");
			character = img.getSubimage ((32 * animationNumber), (32 * offset), 32, 32);
			animationNumber ++;
			if (animationNumber == 4){
				animationNumber = 1;
			}

so you could easily factor out all that repeated code. It's also unlikely that you need (or want) to reload your images constantly as your animation runs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look at all of the identical code in your if-else cases. The only part of those code blocks that varies is the setColor() call. The rest is executed for every case, so it doesn't need to be in your if() blocks. Don't repeat more code than you need to.

For your 'cel' calc, be careful about mixing integers with float division. 5 and 9 are ints, so consider how that impacts your formula result.

To change the alignment, you'll have to change where you draw the strings. That may involve some calculations on the string lengths as well. You can check this entry in the Java 2D graphics tutorial about measuring text: http://download.oracle.com/javase/tutorial/2d/text/measuringtext.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

After you get it to compile, consider that the only part of your code that will be different in all of those if-else cases is the check for which color to use.

You don't need to repeat all that code in each case. Just check the current value of 'faren' and set your color.

Also note that Applets don't use a main() method. Just remove that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Start with using valid math symbols so that your program will compile.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll need to open your output stream in append mode:
http://download.oracle.com/javase/6/docs/api/java/io/FileOutputStream.html#FileOutputStream(java.lang.String,%20boolean)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The answer seems very clear: You should write the project in VB.NET.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... and what is your specific question?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Threads merged. Please don't start additional threads for a single question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a glance at this article from the OpenGL wiki about drawing 2D controls over a 3D scene: http://www.opengl.org/wiki/Viewing_and_Transformations#How_do_I_draw_2D_controls_over_my_3D_rendering.3F

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You really should not stuff all that GUI code into your main() method, but that's another discussion altogether.

You can still get a reference to the class statically and use getResource like this

Main.class.getResource(...)
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I never bothered with it myself. Perhaps it may help you get that first real job, but beyond that your working experience will be more of a factor than certs in future work. I only know one person who bothered with the JCP and that was only because he was between contracts at the time and just looking for something to do.

If you do decide you'd like to take it, don't pay some prep company a bunch of money to train you for it. There are plenty of reference and practice exams available on the net.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> And is OCPJP alone any worth?
It shows you can study for and pass basic tests. That is about all.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It should also tell the line the error is occurring on.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@Taywin: You're allowed to initialize a final instance variable like that in the constructor one time. You cannot make further assignments to it though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your expectations are completely unreasonable. You don't know Java, you don't know anything about Android, and you want to create a complex application with them. Do you see any issues there?

If you do want to start working on this, start with Hello World with the Android SDK: http://developer.android.com/resources/tutorials/hello-world.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you want to pass an instance of your MyDate class as a parameter, you'll need to create it with 'new' keyword: new MyDate(...) .

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> so all i need is a simple code to make what seems to be a complex task
It is a complex task. What makes you think there is a simple code for it? And why should someone else write it for you?

This is your project and you need to make the effort. Ask specific questions when you get stuck. Have you done any Android programming at all? Have you downloaded the SDK yet?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Compare your use of the Student constructor in your main() method with the constructor that you defined in the Student class. The compiler is telling you they are quite different.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java is case sensitive. Check the spellings of your classes.

Also note that by convention class names should start with a capital letter.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You haven't asked a question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Paste the exact error message. It tells you what it cannot resolve.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Or is its only purpose to allow me to right click and select "copy link location"?
That's the only purpose that I'm aware of. It allows you to link directly to the post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Did you search "email jsp" on the forums?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You code needs to be in a method. You currently have it in the body of the class itself.

Look at your other programs or examples and note how they declare a main() method and put the code in there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the stack trace of the errors. They will tell you exactly what the errors are and what line they occur on.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> im clueless on how to get it to see the amount of grades that were entered
Seems like a fairly simple task for a variable.

Edit: Ah, well so much for letting you see the solution for yourself, since hfx642 has decided to just hand you a fix.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Seems like counting them might be useful?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are dividing by the length of the grades array, but not all of those elements have a value. You need to divide by the actual number of entries the user has added.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is exactly what your args parameter to the main method is for.

In the example you mentioned,"java test 2 3", args would include {2,3}.

You can simply access them by index.

int a = args[0];
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I am marking this solved since you have now created another new thread to continue this.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could also use something like this example with a JList: http://www.java2s.com/Code/Java/Swing-Components/TableRowHeaderExample.htm

Majestics commented: Thanx........ +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just add the data to your table model. If you want to render it differently, you can create a custom table cell renderer for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you tried just specifying "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"?

Majestics commented: Thanx a million. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're going to need to increment y and repaint() at some point.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'd also recommend re-writing the code to put the code you have in those switch cases into a function or use a variable for which array elements to operate on, because the only differece between them seems to be"fixdep_status-1" vs "fixdep_status-2".

There's no reason to repeat that much code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is not a way for that to fall through both conditions on your switch. Use an if condition instead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The error clearly states that on line 83 of your mertSort class you are trying to access index 2 of an array that does not have that many elements.

Find out why your indices are going out of bounds. Use println statements to test the conditions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You still didn't post the errors.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have not declared the readArguments() method correctly. Check the method signature and figure out what is missing.

You also do not have a "readArray" variable in main() at all. You can't pass an argument that doesn't exist.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That's your assignment, not a specific question. What are you having trouble with specifically? If you're receiving errors, post the stack traces.