Lab 3 - 24

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

o You CAN create more classes /methods/variables (if needed).

o You can change test data by change file data.txt


o Time to finish 60 min
Question

Download given from CMS and changes the Project name &
folder with format: RollNumber, ex: HE171021. Use
Netbean open it then modify the project name to your
rollnumber like image above Code and run debug when finish u need zip
folder RollNumber and upload bellow to your class assignment! (1 point will be
deducted for each request if not fulfilled)

Write Class: follow instruction in bellow given

Create a Project with format: RollNumber_Lab3

Create Class: follow instruction in bellow given

when finish u need zip folder RollNumber_Lab3 and upload bellow to your class
assignment!

1- Create an Employee Class with data: string (ID, Name, Address), Age int and
more Method get/set/toString/constructor … if needed
- Build a method to calculate employee salary with no parameters: formula for
calculating salary by 5000000+ (age – 20)*100000;
2- Create interface IWorker include 3 method as following:

3- Create class Worker inheritance class Employee and implements IWorker. add
the double Salary and int worker level data property to class Worker.
Implements f1: print all worker. Output show as:
OUTPUT:
(1, NVAn, hanoi, 21, 2, 5100000.0)
(2, LHHung, hochiminh, 25, 3, 5500000.0)
(3, HAThu, namdinh, 37, 4, 6700000.0)
(4, HTNghia, bacgiang, 41, 5, 7100000.0)
(5, LDTho, hanoi, 55, 6, 8500000.0)
(6, NDVinh, hoabinh, 28, 1, 5800000.0)
6
Implements f2: recalculate salary in which if the address with hanoi or hochiminh
the allowance will be increased by 500,000 VND and Display a list with workers
with added priority by 500000vnd first.
OUTPUT:
(1, NVAn, hanoi, 21, 2, 5600000.0)
(2, LHHung, hochiminh, 25, 3, 6000000.0)
(5, LDTho, hanoi, 55, 6, 9000000.0)
(3, HAThu, namdinh, 37, 4, 6700000.0)
(4, HTNghia, bacgiang, 41, 5, 7100000.0)
(6, NDVinh, hoabinh, 28, 1, 5800000.0)

Implements f3: recalculate salary by formula:


Level *1600000+ (age – 18)*50000; if level <=5
1
if level >5 then salary calculate by formula:
Level *1800000+ (age – 18)*50000 + (age – 40)*100000 where if age is less
than 40 to avoid negative number
OUTPUT:
(1, NVAn, hanoi, 21, 2, 3350000.0)
(2, LHHung, hochiminh, 25, 3, 5150000.0)
(3, HAThu, namdinh, 37, 4, 7350000.0)
(4, HTNghia, bacgiang, 41, 5, 9150000.0)
(5, LDTho, hanoi, 55, 6, 1.265E7)
(6, NDVinh, hoabinh, 28, 1, 2100000.0)

Before upload. Zip your folder as bellow:

When double click to Zip folder above it show as

You might also like