Loading...
Loading...
Loading...
An employee earns Rs. 200 an hour and a developer Rs. 500 an hour. An intern gets a fixed Rs. 8000 whatever the hours. A team lead is a developer who also gets Rs. 10000 on top. Build Employee, Developer extends Employee, Lead extends Developer and Intern extends Employee, each overriding long pay(long hours).
EMP, DEV, LEAD or INTERN), a one-word name and the hours worked.<name> <pay> for each person, then Highest <name> (the first one listed on a tie).Example
Input
4 EMP Rohan 40 DEV Priya 40 INTERN Arjun 40 LEAD Kavya 30
Output
Rohan 8000 Priya 20000 Arjun 8000 Kavya 25000 Highest Kavya
Kavya: 30 × 500 + 10000 = 25000, more than Priya's 20000.
Try the problem first. Open one hint at a time.
Lead.pay is super.pay(hours) + 10000, and super there is Developer.
Keep the best pay and name while looping; replace only on a strictly higher pay.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor