ClassScheduleTester.java public class ClassScheduleTester
{
public static void main(String[] args)
{
ClassSchedule class1 = new ClassSchedule("Intro to Java","MWF","9:00", "9:50","Turing 101");
// your work here - test the getTime method
ClassSchedule class2 = new ClassSchedule("Operating Systems","TTh","12:30","13:45","Turing 307");
// your work here - test the setStartTime method
}
}
Use the following file:
ClassSchedule.java
/**
A class has a title, time and room
*/
public class ClassSchedule
{
private String title;
private String days;
private String startTime;
private String endTime;
private String room;
/**
Constructs a class with title, day, time and room.
*/
public ClassSchedule(String classTitle, String meetingDays, String aStartTime, String aEndTime, String classRoom)
{
title = classTitle;
days = meetingDays;
startTime = aStartTime;
endTime = aEndTime;
room = classRoom;
}
/**
Gets the title.
@return the title
*/
public String getTitle()
{
return title;
}
/**
Gets the time in the form "days start time-end time".
@return the time
*/
public String getTime()
{
String time = days + " " + startTime + "-" + endTime;
return time;
}
/**
Gets the room.
@return the room
*/
public String getRoom()
{
return room;
}
/**
Sets the days.
*/
public void setDays(String meetingDays)
{
days = meetingDays;
}
/**
Sets the start time.
*/
public void setStartTime(String aStartTime)
{
startTime = aStartTime;
}
/**
Sets the end time.
*/
public void setEndTime(String aEndTime)
{
endTime = aEndTime;
}
}