(1)設(shè)計(jì)一個(gè)人事管理的People(人員)類.考慮到通用性,這里只抽象出所有類型人員都具有的屬性:name(姓名),number(編號), sex(性別),birthday(出生日期),id(身份證號)等等.其中"出生日期"定義為一個(gè)"日期"類(具有屬性:year(年),month (月),date(日)內(nèi)嵌子對象.用成員函數(shù)實(shí)現(xiàn)對人員信息的錄入和顯示等必要功能操作(自己獨(dú)立思考設(shè)計(jì)).要求包括:構(gòu)造函數(shù)和析構(gòu)函數(shù),拷貝構(gòu)造 函數(shù),內(nèi)聯(lián)成員函數(shù).
(2)從People(人員)類派生出Student(學(xué)生)類,添加屬性:班號char chassNO[7];從People類派生出teacher(教師)類,添加屬性:職務(wù)char principalship[11],部門char department[21].從Student類中派生出graduate(研究生)類,添加屬性:專業(yè)char subject[21],導(dǎo)師teacher adviser(為(教師類內(nèi)嵌子對象);從graduate類和teacher類派生出TA(助教生)類,注意虛基類的使用,重載相應(yīng)的成員函數(shù).
(3)對People類重載"=="運(yùn)算符和"="運(yùn)算符,"=="運(yùn)算符判斷兩個(gè)People類對象的id屬性是否相等;"="運(yùn)算符實(shí)現(xiàn)People類對象的賦值操作.
(4)定義一個(gè)對People類對象數(shù)組按編號排序的函數(shù),一個(gè)按編號查找people對象的函數(shù).
標(biāo)簽:
birthday
People
number
name
上傳時(shí)間:
2014-01-17
上傳用戶:GHF
This book uses the Python language to teach pro
-
gramming concepts and problem
-solving skills, without assuming any previous program- ming experience. With easy-to-understand examples, pseudocode, flowcharts, and other
tools, the Student learns how to design the logic of programs and then implement those
programs using Python. This book is ideal for an introductory programming course or a
programming logic and design course using Python as the language.
As with all the boolts in the
Starting Out With
series, the hallmark of this text is its clear,
friendly, and easy
-to-understand writing. In addition, it is rich in example programs that
are concise and practical. The programs in this book include short examples that highlight
specific programming topics, as well as more involved examples that focus on problem
solving. Each chapter provides one or more case studies that provide step
-by-step analysis
of a specific problem and shows the Student how to solve it.
標(biāo)簽:
language
gramming
concepts
problem
上傳時(shí)間:
2014-01-12
上傳用戶:獨(dú)孤求源