public static void Main(String[] args)
Console.Write("Enter employee name: ");
emplo = Console.ReadLine();
Console.Write("Press F for Full Time or P for Part Time: ");
if (choice == 'F' || choice == 'f' || choice == 'P' || choice == 'p')
Console.WriteLine("\n--- Full Time Employee ---");
Console.Write("Enter Monthly Salary: ");
var FULLTE = new FullTimeEmployee(emplo, Convert.ToDouble(Console.ReadLine()));
Console.WriteLine("\n--- Part Time Employee ---");
Console.Write("Enter rate per hour and no. of hours worked seperated by space: : ");
var PARTTI = new PartTimeEmployee(emplo, Convert.ToDouble(Console.ReadLine()), Convert.ToInt64(Console.ReadLine()));
Console.WriteLine("ERROR: Unknown employee type");
public Employee(String name)
public void setName(String name)
public void writeOutput()
Console.WriteLine("Name: " + this.name);
public class FullTimeEmployee : Employee
private double monthlySalary;
public FullTimeEmployee(String name, double salary)
this.monthlySalary = salary;
public void setSalary(double salary)
this.monthlySalary = salary;
public double getSalary()
return this.monthlySalary;
public void writeOutput()
if ((this.monthlySalary <= 0))
Console.WriteLine("System Error. Please Try Again");
this.super.writeOutput();
Console.Write("Monthly Salary: %,.2f",this.monthlySalary);
public class PartTimeEmployee : Employee
private double ratePerHour;
public PartTimeEmployee(String name, double rate, int hours)
this.hoursWorked = hours;
public void setHourlyRate(double rate)
public void setHoursWorked(int hour)
wage = this.ratePerHour * this.hoursWorked;
public void writeOutput()
if (this.ratePerHour <= 0)
Console.WriteLine("System Error. Please Try Again");
else if (this.hoursWorked <= 0)
Console.WriteLine("System Error. Please Try Again");
this.super.writeOutput();
Console.Write("Wage: %,.2f",this.getWage());