Created
January 31, 2020 19:38
-
-
Save ataraxie/be216aa1ddfebdc54927939227a76874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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