回分類題庫
d281: 104OOP Lab Exercise:Salary System
出處:

Difficulity : N/A
Accepted : 61 Times | Submit :274 Times | Clicks : 811
Accepted : 56 Users | Submit : 58 Users | Accepted rate : 97%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2015-12-04 23:54

Content :

實作Staff, Manager, Engineer和Intern四個class
Staff是抽象類別
Manager, Engineer和Intern繼承Staff
 
-類別說明 
(1)Staff有三個私有成員
minSalary: int
seniority: int
bonus: int
(2)Staff有五個公共成員
int getMinSalary()
int getSeniority()
int getBonus()
virtual int getTotalSalary() = 0
virtual void print() = 0
(3)Manager, Engineer和Intern有兩個公共成員
int getTotalSalary()
void print() 
 
-方法說明 
(1)getTotalSalary()會回傳每位Staff的薪水
-Manager
Total salary = minSalary * (1 + seniority * 0.35) + bonus
-Engineer
Total salary = minSalary * (1 + seniority * 0.25) + bonus * 0.5
-Intern
Total salary = minSalary + bonus * (seniority * 0.2)
(2)print()會印出薪水,格式如下
Staff’s total salary: totalSalary
例:Manager’s total salary: 200000 

Input :

(1)第一行為minSalary,格式如下
min salary: minSalary

(2)如果有bonus,第二行為bonus,格式如下
bonus: bonus

(3)接下來三行分別為Manager, Engineer和Intern的年資,格式如下
Staff’s seniority: seniority

(4)若讀到-1,輸出所有Staff的薪水,並結束程式
 
 

Output :

接收到-1之後,依序(順序:Manager, Engineer, Intern)輸出所有Staff的薪水,格式如下

Manager’s total salary: totalSalary

Engineer’s total salary: totalSalary

Intern’s total salary: totalSalary




Sample Input :

min salary: 22000
Manager’s seniority: 8
Engineer’s seniority: 5
Intern’s seniority: 2
min salary: 52000
bonus: 50000
Manager’s seniority: 22
Engineer’s seniority: 9
Intern’s seniority: 1
min salary: 36000
Manager’s seniority: 15
Engineer’s seniority: 13
Intern’s seniority: 2
-1

Sample Output :

Manager's total salary: 83600
Engineer's total salary: 49500
Intern's total salary: 22000
Manager's total salary: 502400
Engineer's total salary: 194000
Intern's total salary: 62000
Manager's total salary: 225000
Engineer's total salary: 153000
Intern's total salary: 36000

Hint :


  

Author :

(管理員:oopTA)

  Solve it!   Status Forum (0)

C++
C
JAVA
69835. oop103703043 (126 ms , 1274KB)
69868. oop103703003 (132 ms , 1258KB)
69863. oop102703011 (168 ms , 1248KB)
69931. oop100702034 (178 ms , 1254KB)
69930. oop100702034 (194 ms , 1246KB)
沒有解題記錄 86427. nwgs524513cja (576 ms , 20110KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡