I am calling a non-static instance method to a static context. How can i get around this? i know it is probably a simple problem, but please help. its a long source file so i have a text file link Source File. Thank You very much
Create an instance and call the method thru the instance.
Most likely you'll want to do the second since getter methods like isSenior() are generally used to retrieve state from a particular instance. I noticed a call Senior.isSenior() in your class, but saw neither a reference nor a class named Senior.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Steve, I agree with Mike, create an instance and call the method. Static methods should be reserved for CLASS functionality. The 'isSenior' method is really associated with an INSTANCE of Student. Also making 'isSenior' static would mean that it could only access static class variables and you have a reference to the instance variable 'creditsEarned'. Understand that static variables and methods are created at class load time, ie before any instance is created when the non static members are created. If you never instantiate a Student object, the class will still have a reference to all static members but not to any of the non-static ones. Sunil
I also have a suggestion to help with managing your code. I noticed that main() is very long. You may try to break individual tasks into separate functions. Mostly this helps isolate ideas, so that you don't suffer from data overload (trying to remember too many things at the same time). It would also help when you ask questions here as you should be able to post a single function that has problems. For the most part, these individual functions can be self-contained, especially in this case when they would most likely all be static.