在我學習Java的下一個步驟,我現在對類和繼承。Java類和小類
我有一個功課,但解決我有點卡住,所以我在這裏不要求代碼,但就看你與我在想,如果沒有辦法達成一致,幫助我做一些指導。請理解,不幸的是,我不明白所有的Java,我正在採取這種語言的嬰兒步驟。
所以,現在的問題是:
它的目的是創建一個支持會議的orgazation的程序。會議有一個名稱,一個地點和一個日期。另外,每個會議都有一個組委會和一個計劃委員會。兩個委員會的成員都由姓名,電子郵件地址和機構標識。組織委員會成員在會議中的角色(財務,空間或膳食)也具有特點。程序委員會成員 特徵,反映他們在會議(差,一般,良好,優秀)的前一版的性能參數。此外,計劃委員會成員還與需要審查的文章列表相關聯。
每篇文章的特點是它的標題,作者名單和評價結果(1至5注,其中5是最好的)。每篇文章的最終評估是通過計劃委員會兩名成員進行評估的平均值得出的。作者的特點是姓名,電子郵件地址,機構和註冊費用。這種費用可以有兩種類型:高級(教師或研究人員)和學生。學生應考慮學位(學士,碩士或博士學位)。
會議註冊費爲$ 400老年人和200 $的學生。訂閱授權您提交一篇文章。誰希望提交比文章 高級作者必須支付50 $每增加文章。據認爲,每篇文章的第一作者將負責其在會議上的發言。
有了這個,我必須實現一些功能,但這不是我來這裏的原因。
讀的問題,我可以看到,
name
email
institution
用於識別委員會和作者的成員。
所以我想創造一個
public class Identification{
---------------
name
email
institutionName
---------------
}
,然後一切都變得複雜了,因爲我知道我要創建一些繼承了該類。
我可以創建
public class Conference{
---------------
name
location
date[]
---------------
}
然後
public class Organization extends Conference{
---------------
role[] // 0 for finance, 1 for spaces and 2 for meals
---------------
}
和
public class Program extends Conference{
---------------
performance[] //0 poor, 1 fair, 2 good and 3 excellence
articlesList[] // probably an id of and article
---------------
}
但兩個類組織和計劃有成員和該成員是由相同的事情確定上課鑑定。就像我現在,Java只能擴展一個類,所以現在我堅持這些東西之間的關係。
讀剩下的問題我確定
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
---------------
}
這是方式還是不行。我無法理解是否必須創建所有這些類,以及哪些類擴展了其他類。任何意見?
favolas
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! UPDATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
感謝您的反饋。讓我們看看我是否理解你的一些建議。
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
---------------
}
他這樣嗎?
謝謝dnuttle。 1 - 我的不好。日期是一個數組,因爲索引0將具有年,1個月和2天。 2 - 謝謝。我明白。 3 - 一開始我以爲這樣做,但是我已經放棄了成員超類的道路。 4 - 好的。該角色應該是OrganizationCommitteMember中的變量 – Favolas