javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Try to write a class that saves the objects you create (namely the Inventory instance that has all the DVDs and movies) to a file. Yo could use the classes:

FileInputStream
ObjectInputStream

FileOutputStream
ObjectOutputStream

You objects must also implement the Serializable interface to do that

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In case you have something like this: { [ } ], perhaps you should have some boolean variables for the different brackets(isCloded, isOpened) so you can check that you cannot close something if you are inside a different unclosed bracket. Try to remember the most recent open bracket

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Try using str.charAt(i) in a for-loop. This method returns one by one each char of the String. Then you can count the different brackets that open and close and make sure that each time the bracket count must be positive or zero. At the end of the loop all bracket counts must be zero. You must also check that you don't have a case such as this which is wrong :
{ [ } ]

public static boolean isValid(String str) {
  //code here
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You create a double number2 at the beginning of your program, but
in the function: button3_actionPerformed you create another Double number2. This is not wrong, but the calculateResult function takes as arguments: 1 String and 2 double. The number2 you are passing is not a double primitive type but a Double object.

double calculateResult(String operator, double number1, double number2)

Use something like this:

Double number2 = Double.valueOf(help);
double d=number2.doubleValue();
result = calculateResult(operator,number1,d);
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

And you should be thankful that glowkazaf told you how to do it in the first place even though the way you asked for help was rude. If you opened a Java book you would have found out that what you are being asked to do is the simplest thing in inheritance

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Since you don't know the size of the file why don't you put the strings you read into a Vector and then put the data from the Vector to an array
ex:
String line= readLine() from file
vector.add(line)

When you are done with the file use a for-loop to put the data into an array

PoovenM commented: Cool signature! Plus good advice :) +2
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You are absolutely right there. I had a course in my university about Operating Systems, which I passed with 8, (10 is the max) and all my code was cheated. I took it from an older student who had the same course. But, to my defense I will have to say that the code was in C, they wanted us to build an OS that handles parallel procedures, and we also had written exams which I did very good without cheating

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

At which line do you get the Error?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Actually I already knew about Calendar but I couldn't get the right results. That's why I was looking for the algorithm rajatC posted. The funny thing is that yesterday Calendar wasn't giving me the right results but today for some strange reason the code that I wrote worked. That's why I try to avoid Calendar and work only with Date and SimpleDateFormat. I find it simpler.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Does anyone know where can I find how to calculate how many days February has for a given year?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you show some code

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I think is something like:

roachPopulation.doublePopulation();
lable.setText( roachPopulation.getPopulation() );
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I think that the

private JPanel imagePanel, numberPad;
private JTextField text;

have not been instatiated

Try:

private JPanel imagePanel = new JPanel();
private JPanel numberPad = new JPanel();
private JTextField text; = new JTextField();

If this does not fix your problem try to debug and see what is null

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

By the way the formula for the cylinder is wrong. The one you wrote calculates the volume
The right is : (πr^2) * 2 + h*2πr

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Don't you know how to create constructors or methods with arguments.
Just create a method that takes its arguments and sets them as values in the text fields of your class2. Or when you call class2 give those values in the constructor of class2

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Here some commands from the API

JTextField text=new JTextField ();
String s = text.getText();
text.setText("someString");

Try to 'get' the values from class1 and pass them as arguments when you call class2
Then 'set' those values to the fields of class2
Then when you want to save them in the DB 'get' them again
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/package-summary.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I am sorry for not speaking Martian. That's why I don't understand what you are saying. Try to post again your question. With more details and better explanation

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all you don't instantiate the Triangle inside the main
The getArea() is totally wrong. The formula you are using is only for triangles with 90 degrees.
The Double.parseDouble throws a NumberFormatException. Use try-catch
And you don't declare type inside getType()

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I usually use SimpleDateFormat and Date objects since I am not familiar with the Calendar. Why don't you check them at the sun's API:
http://java.sun.com/j2se/1.5.0/docs/api/overview-summary.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you know what we should do when someone just asks for others just to do their homework?
We should do it, tell them that we did it and it's perfect and NOT give it to them as punishment for their being lazy.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

All the subclasses can use the super's class methods. If you write:

Employee e = new Nurse();

The e will be able to use all the Employee's methods and the Nurse's methods but not the Janitors.
Try to put those isSomething() methods in the superclass or have one method in superclass that returns something that tells you the proffession of the created object

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hello everybody. I am javaAddict. I have been a java addict since 2004.
I came across this site when I was looking for some java project ideas to implement just for fun in order to kill time (yes that's what I do for fun when I am bored: I write java) But when I read more information about his forum I registered in order to help new programmers with their java programs. I didn't have any help when I was beginning, I had to discover a lot of things on my own, so I wanted to pass the knowledge and tell other new programmers what no none told me when I was beginning

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I totally agree when you say that we should help only those who try. This is my first post and I would like to mention this incident:
I am a professional java programmer and I am registered to another forum for students who do java homework. The reason why I registered was because NO one ever taught me how to write java. I had to discover many things on my own. That's why I wanted to see if I could help them with their questions because no one ever helped me. (by the way they don't know what I do for a living when I reply).
Anyway once a student sent me the compile error messages that his program had and asked for my help. I told him the messages he received clearly state what the error was and at which line (ex. he forgot to put a ';' and the message told him the line this happened).
He replied by saying that he knows what the messages mean but he wants me to tell him exactly what to fix in his code and how to write it!
Of course I told him no and gave him some pointers on how to interpret the messages the compiler gives. I didn't register just to do their homework for them. That would be terribly easy and extremely WRONG. Some of them have great ideas when writing code and those I do help with some tips