-
Notifications
You must be signed in to change notification settings - Fork 686
Expand file tree
/
Copy pathCourse.java
More file actions
38 lines (29 loc) · 931 Bytes
/
Course.java
File metadata and controls
38 lines (29 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.launchcode;
import org.w3c.dom.ls.LSOutput;
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Objects;
public class Course {
private String title;
private String instructor;
private int credits;
public Course (String title, int credits, String instructor) {
this.title = title;
this.credits = credits;
this.instructor = instructor;
}
public String toString(){
return title + " Credits: " + credits + " Taught by: " + instructor;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Course course = (Course) o;
return Objects.equals(title, course.title) && Objects.equals(instructor, course.instructor);
}
@Override
public int hashCode() {
return Objects.hash(title, instructor);
}
}