CS1331 Homework 02 - Course Registrar

HW2 Files

Tester

Introduction

This assignment will have you working with arrays, classes, getters, setters, and enums.

Problem Description

Now that summer registration is finally over, you have been officially hired to create a new course registration system. The new system will be similar to the old system, but there are a few marked differences. For example, in your system there will be no restrictions on registration. However, most of the features such as adding classes, a maximum waitlist size, a class size, having no conflicting class times, and others will stay the same.

You will be given Course.java, Department.java, LectureDays.java, LectureTime.java, Student.java, and Time.java. Some of these files (Time.java and LectureTime.java) have already been completed and you don’t need to make any changes to them. The rest are either partially complete or need to be completed entirely by you.

Solution Description

Time.java

This class has two instance variables:

Additionally it has the following methods:

LectureTime.java

This class has three instance variables:

The class also contains the following methods:

Department.java

This is an enum with the following constants:

Additionally there should be a public String toString() method that returns the abbreviation for the constant. The abbreviations (listed in the same order as the Department constants above) are:

LectureDays.java

This should be an enum with the following constants:

Student.java

This class will be used to represent students. The constructor should take in only a String, denoting the students name. Additionally, each student needs the following instance data:

It is important to realize, in our system, that in our new registration system that if a student is taking four 3-credit classes and waitlisted in one 3 credit class, they are classified as taking 15 total credits.

Additionally the class should contain the following methods:

Course.java

Finally you will be creating the course class which will have the following instance data:

Additionally the class should have the following methods:

Tips

You should not import any libraries or packages that trivialize the assignment. This includes data structures other than arrays (so no List, Map, Set, etc). If you are unsure of whether something is allowed, ask on Piazza. In general, if something does a large part of the assignment for you, it is probably not allowed. Important: java.util.Arrays is not allowed. However, that is different from a Java array (e.g int[] nums = new int[10]), which is necessary for this assignment.

Compiling and Testing Your Code

To compile your code, you need to go to the root directory (the folder hw2) and run javac registration/*.java utils/*.java.

We have provided a tester file for hw2. To run the tests, move the Test.java into the hw2 directory. To compile, open you command prompt and ensure that you are in the root directoy (the hw2 folder). Then, use the command javac registration/.java utils/.java *.java to compile your code. To run you code simply use the java Test command. Also, note that passing these test cases will not guarantee that you will get an 100 or not lose any points on the assignment. While this file should help you debug your code, we highly encourage you to look through your own code and do some of your owns tests to ensure it’s bug free.

If you wish to test your code by creating a new java file put the test file in the root directory (hw2) and at the top of the test file (above the public class ...) include the lines following lines:

import registration.Course; import registration.Student; import registration.Department; import registration.LectureDays; import registration.LectureTime; import utils.Time;

Afterwards, to compile this testing file with everything else use javac registration/*.java utils/*.java *.java. Afterwards run your test file by using java testfilename as you normally would.

Javadocs

Checkstyle

You must run checkstyle on your submission. The checkstyle cap for this submission is 15 points. In future homeworks we will be increasing this cap, so get into the habit of fixing these style errors early!

A guide for setting up and running checkstyle can be found on this page on the course website. Make sure you click “Save” when downloading the jar file, and not “Run”. To run, copy the jar file into the registration folder. Run checkstyle for this assignment with java -jar checkstyle-6.2.2.jar -a *.java. This will check for both checkstyle errors and javadoc errors.

Collaboration with other students

When completing homeworks for CS1331 you may talk with other students about:

You may not discuss, show, or share by other means the specifics of your code, including screenshots, file sharing, or showing someone else the code on your computer, or use code shared by others.

Examples of approved/disapproved collaboration:

Collaborating with others in a way that violates the approved means is a Georgia Tech Honor Code violation, and you will also break your TAs hearts :broken_heart:

Turn-in Procedure

Export the hw2 folder and its contents to a .zip file and submit the .zip file on T-Square as an attachment. Make sure the zip file contains Course.java, Department.java, LectureDays.java, LectureTime.java, Student.java, and Time.java. When you’re ready, double-check that you have submitted and not just saved a draft.

Verify the Success of Your Submission to T-Square

Practice safe submission! Verify that your HW files were truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.