阿摩線上測驗
登入
首頁
>
程式語言
>
103年 - 103 地方政府特種考試_三等_資訊處理:程式語言#24837
> 申論題
申論題
試卷:103年 - 103 地方政府特種考試_三等_資訊處理:程式語言#24837
科目:程式語言
年份:103年
排序:0
申論題資訊
試卷:
103年 - 103 地方政府特種考試_三等_資訊處理:程式語言#24837
科目:
程式語言
年份:
103年
排序:
0
題組內容
三、請以物件導向,多型(polymorphism)的技術,改寫下列計算薪水的程式,其中經理(manager)薪水是 40000,工程師(engineer)薪水是 35000。 int getPay(String employeeType) { if (employeeType ==“manager”) { return 40000; else if (employeeType == “engineer”) return 35000; }
申論題內容
1設計 Employee, Manager, Engineer 等三個類別及其屬性(attribute)與方法(method),方法包括建構子(constructor)。其中 Employee 是抽象類別,有一個保護 (protected)屬性薪水(salary);Manager 和 Engineer 是 Employee 的子類別。