Skip to content

Instantly share code, notes, and snippets.

@ataraxie
Created January 31, 2020 19:38
Show Gist options
  • Save ataraxie/be216aa1ddfebdc54927939227a76874 to your computer and use it in GitHub Desktop.
Save ataraxie/be216aa1ddfebdc54927939227a76874 to your computer and use it in GitHub Desktop.
package ca.ubc.cpsc210.snippeting.examprep;
// Represents a task having a related course and number of hours remaining to complete
// Author: norm, modified by PC
public class Task {
private String courseName;
private int hours;
// EFFECTS: constructs a task with an associated course name
// and expected number of hours to complete
public Task(String courseName, int hours) {
this.courseName = courseName;
this.hours = hours;
}
public String getCourseName() {
return courseName;
}
// EFFECTS: returns number of hours that remain to complete this task
public int getHours() {
return hours;
}
// MODIFIES: this
// EFFECTS: applies numHours hours to this task (subtracts
// numHours from total hours needed to complete the task)
public void applyHours(int numHours) {
this.hours -= numHours;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment