Hey all i have a quick question about objects of a class... im working on a hw assignment, i only want a hint in the right direction, not the whole answer.... basically we have five classes and there are 3 im working with.... the main class reads in a text file which im doing fine, the other is a Files.class Homework.class and a Name.class when i call a new homework i also create a new name new files
these are the methods that i have for creating a new homework
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;
}
what im trying to do is pass in a first and last section and date which is the third HW method.......
my question is in the main class how do i add a file from the main..... or in main do i have to extend the file and name class and construct it from there and pass it in as a new homework?
ie in main
Homework []homework = new homework[size];
Files []files = new Files[size];
Name[]name = new Name[size];
//add appropriate code to fill in from here....
or is there an easier way in main to implement all the classes... other note im not allowed to modify Homework.class, name.class, or files.class
thanks in advance