Marc Hauschildt
Web Technologies and Computer Software Development Instructor at Kirkwood Community College in Cedar Rapids, IA.
Week 1
Professor |
---|
- salary : double |
+ getSalary(): double + setSalary(double): void + toString(): String |
Student |
---|
- gradeLevel : int - gpa : double |
+ getGradeLevel(): int + setGradeLevel(int): void + getGpa(): int + setGpa(int): void + toString(): String |
User |
---|
- userId : int - firstName : String - lastName : String |
+ getUserId : int + setUserId : void + getFirstName : String + setFirstName : void + getLastName : String + setLastName : void + toString : String |
is a
is a
Objects are often associated with other objects.
For example:
A professor instructs a course
A student enrolls in a course
A course has enrollments
Associations are modeled as lines connecting the two classes.
Associations can be clarified by depicting labels and directionality.
Enrollment |
---|
- student : Student - course : Course - finalGrade : char |
+ getStudent(): Student + setStudent(Student): void + getSection(): Section + setSection(Section): void + getFinalGrade(): char + setFinalGrade(char): void + toString() |
Course |
---|
- courseId : int - title: String - featured: boolean |
+ getCourseId(): int + setCourseId(int): void + getTitle(): String + setTitle(String): void + isFeatured(): boolean + setFeatured(boolean): void + toString(): String |
instructs
has
has
Professor |
---|
Student |
---|
User |
---|
Enrollment |
---|
Student |
---|
GradeReport |
---|
- student : Student - enrollments : List<Enrollment> - dateCreated : LocalDate |
// methods omitted |
receives
composed of
has
The multiplicity of the association is labeled on either end of the line, one multiplicity indicator for each direction
Each student has 0 or more enrollments.
Each enrollment has 1 student.
Each professor instructs 0 to 5 courses.
Each course has 1 to 3 professors.
Indicator | Meaning |
---|---|
0..1 | Zero or one |
0..* | Zero or more |
0..n (such as 0..10) | Zero to n (such as zero to ten) |
n (such as 1) | Exactly n (Only one) |
1..* | One or more |
1..n (such as 1..10) | One to n (such as one to ten) |
Enrollment |
---|
Course |
---|
Professor |
---|
Student |
---|
User |
---|
1
0..*
0..6
1..3
1
0..*
Each course has 0 or more enrollments.
Each enrollment has 1 course.
Your Task:
With the direction of the teacher, create a complete class diagram using one of the tools above.
Your Task:
Identify six nouns from the problem domain above that can be used as classes.
Use a diagramming tool to create a class diagram with access modifiers, data types, parameters, return types, inheritance, associations, composition, multiplicity, and annotations.
git init -b main
git checkout -b main
.env
# Key=Value
By Marc Hauschildt
Web Technologies and Computer Software Development Instructor at Kirkwood Community College in Cedar Rapids, IA.