Executive Summary

You will be implementing a simple applictation to keep track of an academic schedule here at USNA. The User csan list sections for a given course, add a section to their schedule, and view their week in the ususal grid format. If you scroll down to "Part 5", you can see an example run of the program.
Note: The primary goal is for you to show good Object Oriented Programming practices — specifically Encapsulation and Information Hiding — in your solution!

Honor: The course policy and the instructions it references, most pertinently COMPSCIDEPTINST 1531.1C, spell out what kinds of assistance are permissable for programming projects. The instructor can give explicit permission for things that would otherwise not be allowed. For this project, you have explicit permission
  1. to get help from both Spring 2015 IC211 instructors (any assistance must be documented though), and
  2. to use general purpose Java resources online (though such use must be documented). Resources that might specifically address this project, say looking through code of programs that track academic schedules, are not allowed.
Put together the instructions referenced in the course policy and the explicit permissions above, and what you get is summarized as:

Part 1[up to 25pts]: Listing sections

~/$ java Proj01 sections11.txt
> sections IC211
IC211 1001 T12,WF1 MI316
IC211 3002 T34,WF3 MI302,MI202
IC211 5004 T56,WF5 MI302,MI222
> sections IC221
IC221 2004 MW2,R12 MI302
IC221 4002 MW4,R34 MI316
IC221 4003 MW4,R34 MI302
IC221 6001 MW6,R56 MI316
> sections XY001
> quit
A Part 1 solution is a program that processes the following two user commands: The file containing section data is given as a command-line argument when running the program. The program must print the following usage message if no command-line argument is given:
usage: java Proj01 <sectionsfile>
For this Part you may use the file sections11.txt, that only contains 11 sections. You may hard-code the assumption that there are exactly 11 sections to be read in - for this part only!

Hint: Recall from Lab 2 that you can create a Scanner that reads from a file with the following code:

Scanner sc = null;
try { sc = new Scanner(new FileReader(fname)); } 
catch(IOException e) { e.printStackTrace(); System.exit(1); }
... where fname is a String containing the filename.

Part 2[up to 50pts]: Listing sections, arbitrary-length files of section data

~/$ java Proj01 sectionsCS.txt
> sections IT360
IT360 2002 MF2,R12 MI222,MI392
IT360 4001 MF4,R34 MI295,MI392
> quit
A Part 2 solution is exactly the same as a Part 1 solution, except that you may not assume that the file of sections has only 11 entries — it may have an arbitrary number of entries. (Try sectionsCS.txt, for example.) This is going to require some kind of linked list code! I would encourage you to go look back at the WordRead class from Lab02, or the Queue class from the Class 7 homework. Remember: linked-lists are the same regardless of what type of data you store in them!

Part 3[up to 70pts]: Adding sections, showing schedules

~/$ java Proj01 sectionsCS.txt
> sections IC211
IC211 1001 T12,WF1 MI316
IC211 3002 T34,WF3 MI302,MI202
IC211 5004 T56,WF5 MI302,MI222
> add IC211 3001
Error! Section not found!
> add IC211 3002
> sections IC221
IC221 2004 MW2,R12 MI302
IC221 4002 MW4,R34 MI316
IC221 4003 MW4,R34 MI302
IC221 6001 MW6,R56 MI316
> add IC221 6001   
> show
IC211 3002 T34,WF3 MI302,MI202
IC221 6001 MW6,R56 MI316
> quit
A Part 3 solution extends the Part 2 solution by adding two new commands that allow you to create and show a schedule consisting of multiple sections. Note: Good object oriented design demands that you create a separate class for schedules, even though at this point you'll only need to instantiate a single schedule. Important! You may assume that no schedule ever contains more than 10 sections, which makes your schedule class a bit easier to write.

Part 4[up to 90pts]: A temporary detour into weeks

~/$ java Week
  M T W R F
1          
2          
3          
4          
5          
6          
MWF3
  M T W R F
1          
2          
3 x   x   x
4          
5          
6          
TR6,F56
  M T W R F
1          
2          
3 x   x   x
4          
5         x
6   x   x x
quit 
For Part 4 you are going to create a new class, called Week, that represents the usual grid of periods 1-6 and days MTWRF, and simply remembers whether a period is free or not. Your Week class must be able to:
  1. construct empty weeks
  2. construct weeks based on a standard USNA meeting-time pattern, e.g. MWF3,T34, and
  3. merge two Weeks (i.e. if you are busy a given period in either week, you are busy in the merged week).
Running Week should give a simple testing program that starts with an empty week and continually reads in meeting patterns which are then merged with the current week. The grid gets printed out at each step, as shown in the sample run to the right, with an X marking every period that's "busy".

Important: Meeting time patterns can be a pain in the neck, so I'll explain them here, and give you some code to help. A meeting time pattern is a comma-separated (no spaces!) list of elements, each element consisting of one or more characters representing days {M,T,W,R,F}, followed by a period, which is one of {1,2,3,4,5,6,12,34,56,8,9,10}. So, for example, a common meeting time pattern is MWF4,R34. Sometimes you get something like MF2,W1,T12. To help you deal with this, I'm providing the class DrBrown (DrBrown.java) which provides the static method

public static String[] explode(String pat)
... that takes a String with a meeting time pattern, and returns the pattern "exploded" into its atomic meetings: a string of length two consisting of a day and a single period 1-6. So, for example, exploding "MWF2,R12" gives the array
{"M2","W2","F2","R1","R2"}
This should make your life a lot easier with the Week class. Develop week incrementally: first get the constructors and the printing working. Test thorougly, then get the merging working, and test that thoroughly.

Part 5[up to 100pts]: showing the week-grid for the schedule

~/$ java Proj01 sectionsCS.txt
> add IC211	5004
> add IC220	6002        
> add IT360	2002
> week
  M T W R F
1       x  
2 x     x x
3          
4          
5   x x   x
6 x x x   x
> sections IC221
IC221 2004 MW2,R12 MI302
IC221 4002 MW4,R34 MI316
IC221 4003 MW4,R34 MI302
IC221 6001 MW6,R56 MI316
> add IC221 4003
> show
IC211 5004 T56,WF5 MI302,MI222
IC220 6002 MWF6 MI202
IT360 2002 MF2,R12 MI222,MI392
IC221 4003 MW4,R34 MI302
> week
  M T W R F
1       x  
2 x     x x
3       x  
4 x   x x  
5   x x   x
6 x x x   x
> quit
A Part 5 solution extends the Part 3 solution by adding a command to show the week-grid for the current schedule: Of course you'll make heavy use of the Week class you created in the previous step to do this. Be sure to make good OOP decisions about where to put the pieces of code that provide this new functionality.

When to submit

Project 1 is due by COB on Tuesday, February 10th, according to the course's particular definition of "COB". Late projects incurr a penalty of 3N points, where N is the number of days late. So, a project that is not turned in by COB Tuesday, 10 February, but which is turned in by COB Wednesday receives a 3 point penalty. A project that is not turned in by COB Wednesday, but which is turned in by COB Thursday receives a 9 point penalty. And so on.

What to submit

Your electronic submission must include:
  1. all .java file required to compile and run your program - including the ones you were given in the assignment
  2. the .txt files with section data
  3. a file named README with your name and alpha code, which step you are submitting for, and any issues you know your program has.
Your paper submission must inlcude:
  1. A completed copy of this coversheet on paper.
  2. A printout of your README file plus all of your .java files all done as a single codeprint-generated file! Please make sure that your name and alpha code appear in evey single file .java file.

How to submit

The paper portions of your submission should be stapled together and slid under your prof's door. For electronic submission, continue to use the same method from the previous projects. Within the directory on your Virtual Machine where you have been saving your project, type:
submit proj01 files-to-include
Where files-to-include is a list of all the files you're supposed to submit. Submitting more than you need to submit is always OK. Just be sure that all the files needed to compile and run your project are there. So, assuming you have a directory for this project and that you are in that directory, you could submit like this:
submit proj01 README *.java *.txt
You may submit files at any time, but only the last submission will be used for grading.

How projects are graded / how to maximize your points

Things to keep in mind to receive full marks:
  1. Submit all required items (as described above) on time.
  2. Make sure your output matches the example output in all ways.
  3. Use good object-oriented design! The means adhering to the principles of ecapsulation and data/information hiding. This means making good decisions about what to turn into classes.
  4. Practice good Java Style. This means proper indentation, use of whitespace within lines of code, logical organization of chunks of code, proper naming of classes, methods, fields and constants in accordance with Java conventions. This means good commenting: your name & alpha in every file, and descriptive comments for each public method at a minimum!
Most important: Look at the the grading sheet!