CS1331 Homework 03 - T-humans

Introduction

This homework will cover basic inheritance.

Problem Description

Georgia Tech is coming out with a new T-square called T-humans just for keeping track of the humans here at Tech. You will be responsible for implementing and organizing multiple classes in a coherent manner. You will need to familiarize yourself with super/subclasses and constructor chaining.

You will need to create and organize Person.java, Student.java, Undergrad.java, Grad.java, Professor.java, and University.java. Person should be at the top of the hierarchy with Professor and Student as direct subclasses. Student then has Undergrad and Grad as subclasses.

Solution Description

The Person Class

This class has the following instance variables:

This class has the following methods:

The constructors for this class should be able to accept one, two, or all three arguments (instance variable values).

NOTE: Use constructor chaining for this. Order matters!

The Student Class

Subclass of Person. This class has the following instance variables:

This class requires an explicit constructor that must take in and set avgGPA, gtID, and classes along with any other instance data required by the superclass.

This class should have the following methods:

The Undergrad Class

Subclass of Student. This class has the following instance variables:

This class requires an explicit constructor that must take in and set sleepHours along with any other instance data required by the superclass.

This class has the following methods:

The Grad Class

Subclass of Student. This class has the following instance variables:

This class requires an explicit constructor that must take in and set thesisTitle along with any other instance data required by the superclass.

This class has the following methods:

The Professor Class

Subclass of Person. This class has the following instance variables:

This class requires an explicit constructor that must take in and set classSize and classes along with any other instance data required by the superclass.

This class should have the following methods:

The University Class

This class has the following instance variables:

This class requires an explicit constructor that must take in and set name as well as instantiate students and professors.

This class should have the following methods:

Clarifications and 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.

We recommend you test your code by doing the following:

Javadocs

Checkstyle

You must run checkstyle on your submission. The checkstyle cap for this submission is 30 points. All hashcode() checkstyle will NOT be counted against you for this assignment.

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”. It is useful to copy the jar file to your homework directory or set up an alias for it. 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.

Turn-in Procedure

Export the hw3 folder to a .zip file and submit that on T-square. Make sure the zip file contains Grad.java, Person.java, Professor.java, Student.java, Undergrad.java, and University.java.

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.