You are on page 1of 2

Example

p
y A small company with 20 employees has decided to give some bonus to 
employees whose performance rating is satisfactory. The performance 
5, 5
is evaluated on a scale from 0 to 5, with 5 indicating the best  g
performance. For employees with a rating 3, a 2% bonus will be given,  
and those with a rating of 4, a 3% bonus will be given. For employees 
with a rating of 5, a 4% bonus will be given; further, if the employee has 
an experience greater than 6 years, an extra $3,000 holiday bonus is 
awarded.
y Write a script to determine the amount of bonus awarded to the 20 
employees. The script should take an input matrix from a data file for 
the employee information as follows
⎡ 01 3 1 45321⎤
y 1st column: employee ID
⎢02 4 1 39278⎥
nd
y 2 column: performance rating ⎢ ⎥
y 3rd column: number of years of experience ⎢ 03 5 2 73489⎥
⎢ ⎥
y 4th column: salary 04 2 8 29340
⎢ ⎥
⎢M M M M ⎥
⎢ ⎥
CS1003 Introduction to Computer Programming ⎣⎢ 20 1 4 41290 ⎥⎦ 16
Start

Get data filename

N Found data 
Display error message
file ?
Y
End Read in employee data
Flow Chart
Y
Bonus = 2% of salary Rating== 3?

N
Y
Bonus = 3% of salary Rating== 4?

N
N
Bonus = 0 Rating== 5?

Y
N Experience  Y Bonus = 3000 + 4% of 
Bonus = 4% of salary
years > 6? salaryy

Display bonus amount

CS1003 Introduction to Computer Programming End 17

You might also like