Hello, I am new here and hopefully posting in the correct forum.
I have never programmed in an OO language before and am in the process of learning Java. I want to write a simple app to get a feel for the language. It will probably be a console app first (I haven't read up on writing a gui app yet). Basically, I want an app I can keep track of my grocery store purchases. For example, I would enter the date, store, item and price for each item I buy. I am having trouble thinking of how this would translate to Java objects. Here is what I have come up with.
A Store class that would simply contain the name of each store I shop at.
An Item class that contains each item I buy (maybe a category as well).
A Purchase class that contains a date of purchase, an item object, a store object and a purchase amount.
Should I split up each of the above classes in their own file, combine them all in one file??
After finishing my "Learning Java" book, I will probably look for a Design Patterns book, but I wanted to get a jump start on Java apps.
Thanks for reading.
David
I have never programmed in an OO language before and am in the process of learning Java. I want to write a simple app to get a feel for the language. It will probably be a console app first (I haven't read up on writing a gui app yet). Basically, I want an app I can keep track of my grocery store purchases. For example, I would enter the date, store, item and price for each item I buy. I am having trouble thinking of how this would translate to Java objects. Here is what I have come up with.
A Store class that would simply contain the name of each store I shop at.
An Item class that contains each item I buy (maybe a category as well).
A Purchase class that contains a date of purchase, an item object, a store object and a purchase amount.
Should I split up each of the above classes in their own file, combine them all in one file??
After finishing my "Learning Java" book, I will probably look for a Design Patterns book, but I wanted to get a jump start on Java apps.
Thanks for reading.
David