Randal Mortell wrote:Sorry. Its me again. So as far as that link for running a run() method in main. Would I call any variables or is that handled in the run method also?
or basically am I mirroring the program to a window? if that makes sense.
Hi Randall once again. No need to sorry, all good.
Now about the code. There are many issues with it. The problem I see, that you're trying to do too many things in one go
without having confident that
what you did so far at least contains 1 part which
is correct. It is not a
Hello, World problem. You need to think about the project as a whole first, might draw some diagrams, one of those could be a Class diagram, so you could see relations of classes. Have you learned about drawing class diagrams?
By extending Main class I meant couple of the very first lines in your Sales and Inventory classes:
Randal Mortell wrote:
Randal Mortell wrote:
Please explain why you're doing that?
I'd suggest you to forget about the
Main class and all interaction of the program and choose one class to work on, either Sales or Inventory. You know that you can add
static main method to one of those classes just for a
test purpose to test it independently from the rest of your program? Later of course you'd need to remove it, but in that manner you wouldn't need to to think about writing 2 classes at the same time, so in that main method you could pass some dummy data to simulate sales or inventory files content.
dummy example:
Once you are confident, that your class has functionality you want it to have and the outcome of it is as expected, you can remove that temporary main method and move on with another class. ONCE you got Sales and Inventory classes, you can think of the other class where program interaction happens. It could be in the Main class as you have now, but it should be at least in other method,
check the tutorial written by one of moderators Winston, kudos to him for that, this tutorial helps thousands of people, you can go through it
here (<-- link).
[interim comment] Campbell Ritchie gave you this tutorial link already, so now you really have to go through it.
When you override methods as you do with
toString method, add @Override notation. Read about it what it does.