/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gradebooktest; /** * * @author jcmt */ public class Gradebook { private String courseName; private Integer day; // must be valid private Integer month;//must be valid private Integer year; //between 2000 and 2014 // write get and set functions for day object // Quiz 1 Jan. 21 //getDay //setDay -- error checking not required public Gradebook() { courseName = "Basketweaving"; day = 20; month = 8; year = 2013; } public Gradebook(String s, Integer i) { setCourseName(s); setDay(i); month = 1; year = 2014; } public Gradebook(String courseName, Integer day, Integer month, Integer year) { setCourseName(courseName); setDay(day); setMonth(month); setYear(year); } public Integer getMonth() { return month; } public boolean setMonth(Integer month) { if ((month < 13) && (month > 0)) { this.month = month; return true; } else { return false; } } public Integer getYear() { return year; } public boolean setYear(Integer year) { if ((year >= 2000)&&(year <=2014)) { this.year = year; return true; } else { return false; } } public Integer getDay() { return day; } public boolean testDay(Integer day) { if ((day > 0)&&(day < 31)) { return true; } else { return false; } } public boolean setDay(Integer day) { if (testDay(day)) { this.day = day; return true; } return false; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; //courseName = cName; } public boolean setDate(Integer day, Integer month, Integer year) { if (setYear(year)) { if (setMonth(month)) { setDay(day); return true; } } return false; } public void displayNameMessage() { System.out.printf("Welcome to the Gradebook for %s\n", courseName); } }