Employee Yearly Salary
Python
Medium
3 views
Problem Description
Read monthly salary and bonus percent. Create Employee class yearly() to return yearly salary with bonus included. Output as integer.
Input Format
One line: salary bonusPercent.
Output Format
One integer yearly.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if len(p)<2: sys.exit(0)
sal=int(p[0]); bonus=int(p[1])
class Employee:
def __init__(self,monthly,bonus):
self.monthly=monthly
self.bonus=bonus
def yearly(self):
base=self.monthly*12
return base + (base*self.bonus)//100
print(Employee(sal,bonus).yearly())
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!