Computer Science, asked by pathaksruti2005, 10 months ago

Write a program with an "Employee" class having two variables one for the named employee (String) and other for base salary (float). Create a function that calculates the total salary by adding 50% HRA to the salary and returns. Create an objectof this class in main function and set the name of the employee, call the salary function and print the calculated salary returned by the function with name of the employee.​

Answers

Answered by Oreki
2

public class Employee {

String name;

float basicSalary;

Employee(String n, float bs) {

basicSalary = bs;

name = n;

}

float calculateSalary(float HRA) {

return basicSalary + (HRA * (1f / 2f));

}

public static void main(String[ ] args) {

Employee employee = new Employee("Om", 25_000);

System.out.println("Salary - ₹" + employee.calculateSalary(5_000));

}

}

Answered by Anonymous
2

Answer:

program in Python

name=str(input("Employee name":))

salary=int(input("Employee salary":))

Explanation:

hi sis how are you ? i'm fine and soon i'll get the power for inbox and i'll inbox you my dear sis but plz wait till that time

Similar questions