嘿,我有大約類的對象一個簡單的問題...即時在HW分配工作,我只希望在正確的方向,而不是整個答案的提示....基本上我們有五個類,有3個即時通訊工作....主要類讀取一個文本文件,即時通訊工作得很好,另一個是Files.class Homework.class和Name.class當我打電話一個新的作業,我也創建新名稱新文件Java的多類屬性
這些都是我有方法可以創建一個新的功課
homework.class
private int id;
private Name name;
private int section;
private Files files;
private int dateSubmitted;
public Homework(int id, Name name, int section, Files files,int dateSubmitted){
this.id =id;
this.name = name;
this.section = section; // initialize the homework to given params
this.files = files;
this.dateSubmitted = dateSubmitted;
}//end public hwk
public Homework(int id, Name name, int section, int dateSubmitted){
this.id = id;
this.name =name; // the second constructor for the homework class
this.section = section;
this.dateSubmitted = dateSubmitted;
this.files = null;
}// end second init homework
public Homework(String first, String last, int section, int dateSubmitted){
this.id = nextAvailableUid();
this.section = section;
this.dateSubmitted = dateSubmitted;
this.name = new Name(first,last);
this.files = null;
}
什麼即時試圖做的是通過在第一和最後一節和日期哪些在第三HW方法.......
我的問題是在主類我如何從主要添加文件.....或主我必須擴展文件和名稱類並從那裏構建並作爲新的作業通過它?
主Homework []homework = new homework[size];
Files []files = new Files[size];
Name[]name = new Name[size];
//add appropriate code to fill in from here....
即或有主更簡單的方式來實現所有的類...其他注意事項IM不允許修改Homework.class,name.class,或files.class
在此先感謝如果
不知道你的問題是什麼。你能更清楚一點嗎? – donnior
主我將如何實現的name.class在可能的話 – hockeyfreak863
縮短的方法是什麼'落實name.class的files.class和homeworks.class'意味着files.class和homeworks.class? – donnior