public static void Main() { int employee_type; Console.WriteLine("Select type of employee:"); Console.WriteLine("_________________________"); Console.WriteLine("1.Montly Employee"); Console.WriteLine("1.daily Employee"); Console.WriteLine("1.One Time employee"); employee_type = Convert.ToInt32(Console.ReadLine()); if (employee_type == 1) { MonhtlyEmployee emp = new MonhtlyEmployee(); emp.salary_calc(); } else if (employee_type == 2) { HourlyEmployee emp = new HourlyEmployee(); emp.salary_calc(); } else if (employee_type == 3) { OneTimeEmployee emp = new OneTimeEmployee(); emp.salary_calc(); } else { Console.WriteLine("Invalid choice"); } }
public void salary_calc() { int tax; Console.WriteLine("Enter Gross salary"); OneTimeEmployee emp = new OneTimeEmployee(); emp.gross_salry = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter employee id"); emp.employee_id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter employee name"); emp.employee_name = Console.ReadLine(); Console.WriteLine("Enter employee position"); emp.employee_position = Console.ReadLine(); Console.WriteLine("Enter employee gender"); emp.employee_gender = Console.ReadLine(); tax = (emp.gross_salry * 30) / 100; emp.net_salary = emp.gross_salry - (tax); Console.WriteLine("*********************************************"); Console.WriteLine("Enter employee id is:" + emp.employee_id); Console.WriteLine("Enter employee name is:" + emp.employee_name); Console.WriteLine("Enter employee gender is:" + emp.employee_gender); Console.WriteLine("Enter employee position is:" + emp.employee_position); Console.WriteLine("Enter employee net salary is:" + emp.net_salary); Console.WriteLine("*********************************************"); }