Studio 7 Design Problems

Procedure

Be sure to commit your work!

Object Types

Rectangle
A rectangle has a length and a width. A rectangle should be able to provide its area and perimeter. A rectangle can indicate whether it is smaller than another rectangle in terms of area. A rectnagle can indicate whether it is in fact a square.
Die
When a Die is constructed, it is specified to have n number of sides. Each time the die is thrown, a random integer is returned in the range 1..n, inclusively.

Fraction
A fraction has a numerator and denominator. A faction should be able to add itself to another fraction, returning a new fraction that represents the sum. A fraction should be able to multiply itself by another fraction, returning a new fraction as the product. A fraction should be able to take the reciprocal of itself, returning that value as a new fraction. A fraction should be able to simplify itself, returning a new fraction as that simplification.

Complex
This is a good one to do if you are thinking of undertaking the Julia set extension. Find somebody who knows about complex numbers if you are not solid with them.
A complex number has a real and imaginary part, each represented as a double. A complex should be able to add itself to another complex number, returning a new compmlex number as the sum (see below). Similarly, a complex number should be able to multiply itself by another complex number, returning a new complex number as the product.

HockeyPlayer
A hockey player has a name and a jersey number. Most players shoot either right or left, but some can shoot either way. A player can be right- or left-handed, but shoot either right or left. This object should be able to react when a player completes a game, recording how many goals and assists the player earned in that game. A player has a certain number of goals and assists he or she has recorded over all games played. Also, a player has a certain number of points, which is the sum of the goals and assists a player has earned. A player has a certain number of games he or she has played.

UnivCourse
A university course has a number, like 131, and a department, like CSE. Each course has a certain number of students currently enrolled. It is possible for students to add or drop the course after the course has been constructed. It should be possible to determine the number of students who are currently enrolled in a course.