Hello everyone. First time poster,
long-ti just started to read this place after seeing it in an O'Reilly book.
I'm taking my first
Java lessons. To get some practice I've been trying to make my Very First Application (that isn't retyped word-for-word from a coursebook) but I may have skipped ahead farther than I can handle.
My goal is to make a program that, when run, prints my next class to a command prompt, along with the room number and start/end time of the class. The way I've been doing this is:
- Make a class Interface creates all the Course objects and handles printing the result
- Make a class Course with the name, start time, end time, day of week and room of the course as variables
- Import the calendar function, make a new calendar object, and get the day of the week from it
- ?
-
Profit!
I'm having trouble tying it all together though, and the more I think about it the more I think I may be going about the whole thing backwards. For instance, I input the data for each course as a series of strings, but that seems like a roundabout way of doing things - I've been looking for a way of importing the variables from a plain text file, so I just have to swap that out next semester when the courses change, but can't find how to do it. Moreover, I can't seem to figure out how to compare the current date and time to the one listed for each object in Course (that is, I'd want a method that goes through the list of courses and finds the next one that matches both the current date and the current time, but it seems I can only manage to check one specific object at a time. I doubt I'm supposed to copy the code for that one check for all 15-odd objects of the same class).
I'm not looking for a full solution, but some pointers to get me started, or even just a general idea of the best way to go about this would be awfully handy.