代码如下:
public class MusicTitle {
String title ="Notitle.";
String artist="No artist.";
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
}
public class MusicStore {
String owner="Noowner.";
int openTime =0;
int closeTime=0;
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public void setOpen(int openTime){
this.openTime=openTime;
}
public int getOpen(){
return openTime;
}
public void setClose(int closeTime){
this.closeTime=closeTime;
}
public int getClose(){
return closeTime;
}
public boolean isOpen(){
AltDate AltDate=new AltDate();
int nowtime = AltDate.getHourInt() ;
if(nowtime>=this.getOpen() && nowtime<=this.getClose()){
return true;
}
else{
return false;
}
}
public String getOpenClosedMessage(){
if(isOpen()){
return "We're Open!";
}else{
return "We're Closed!";
}
}
public void displayHoursOfOperation(){
System.out.println("StoreHours:");
System.out.println("Daily:"+this.getOpen()+":00 AM-"+this.getClose()+":00 PM");
}
public String toString(){
return "Owneris:"+ getOwner();
}
MusicTitle[] title=null;
public MusicTitle[] getTitle() {
return title;
}
public void setTitle(MusicTitle[] title) {
this.title = title;
}
public void displayMusicTitles(){
for(int i=0;i