On my next step of learning Java, I'm now on Classes and Inheritance.
I have one homework to solve but I'm a little stuck so I'm here not asking for code but to see if you agree with the way I'm thinking and if not, help me with some guidance. Please understand that unfortunately I do not understand all of Java and I'm taking baby steps on this language.
So, here is the problem:
It is intended to create a program that supports the orgazation of conferences. A conference has a name, a location and a date. In addition, each conference has a organization committee and a program committee. Members of both committees are identified by name, email address and institution. The organization committee members are also characterized for their role in the conference (finance, spaces or meals). The program committee members are characterized by a parameter that reflects their performance in the previous edition of the conference (poor, fair, good, excellent). In addition, program committee members are also associated with a list of articles that need review.
Each article is characterized by it's title, list of author's and the evaluation result (note between 1 and 5, with 5 being the best). The final evaluation of each article is obtained by the average of the evaluations conducted by two members of the program committee. The authors are characterized by name, email address, institution and registration fee. This fee can be of two types: senior (teachers or researchers) and students. Students should consider the degree (bachelor, master or doctorate).
The conference registration fee is 400$ for seniors and 200$ for students. A subscription entitles you to submit one article. Senior authors who want to submit more than an article must pay 50$ for each additional article. It is considered that the first author of each article will be responsible for its presentation at the conference.
With this I have to implement some functions but that's not why I'm here.
Reading the problem i can see that
name
email
institution
is used to identify member's of committee and authors.
So I was thinking of creating an
public class Identification{
---------------
name
email
institutionName
---------------
}
and then everything gets complicated because I know I have to create some that extend that class.
I can create
public class Conference{
---------------
name
location
date[]
---------------
}
and then
public class Organization extends Conference{
---------------
role[] // 0 for finance, 1 for spaces and 2 for meals
---------------
}
and
public class Program extends Conference{
---------------
performance[] //0 poor, 1 fair, 2 good and 3 excellence
articlesList[] // probably an id of and article
---------------
}
but both classes Organization and Program have members and this members are identified by the same thing that is on class Identification. As I now, Java can only extend one and only one class so now I'm stuck how this things relation between themselves.
Reading the rest of the problem I identify
public class Article{
---------------
title
listOfAuthors[] //probably an id
evaluation //this is done by two members on program committee but I can't figure out how they relationship between themselves.
---------------
}
public class Authors{
---------------
type[][] // 0 for seniors and 1 for students on first column and 0 teachers, 1 researchers, 2 bachelor, 3 master and 4 doctorate on second column.
numberOfArticles //how many articles author wants to submit
conferenceFee[] // if on type[i][0] is 0 then Fee is 400 + (numberOfArticles * 50) else is 200
---------------
}
Is this the way or not. I can't understand if I have to create all of this classes and what class extends the other class. Any comment?
favolas
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!UPDATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thanks for all your feedback. Let's see if I understood at least some of your suggestions.
public class Member{
---------------
memberID
name
email
institutionName
---------------
}
public class Authors extends Member{
---------------
authorsID
conferenceFee
---------------
}
public class Seniors extend Authors{
---------------
degree[] // 0 for teachers 1 for researchers
numberOfArticles = // Some int
fee = 400
public int payment(int numberOfArticles ){
return numberOfArticles * fee;
}
---------------
}
public class Students extend Authors{
---------------
degree[] // 0 bachelor, 1 master and 2 doctorate
numberOfArticles = // Some int
fee = 200
public int payment(){
return fee;
}
---------------
}
public class Article extend Authors{
---------------
articleID
title
listOfAuthors[] //probably an id
---------------
}
public class ProgramCommitteeMember extends Member{
---------------
role[] // 0 for finance, 1 for spaces and 2 for meals
---------------
}
public class OrganizationCommitteeMember extends Member{
---------------
lasYearPerformance[] //0 poor, 1 fair, 2 good and 3 excellence
articlesList[] // probably an id of and article
---------------
}
public class Committee{
---------------
committeeType[] // 0 for Organization Committee and 1 for Program Committee
---------------
}
public class OrganizationCommittee extends Committee{
---------------
listOfMembers[] //member id
---------------
}
public class ProgramCommittee extends Committee{
---------------
listOfMembers[] //member id
---------------
}
His this the way?