static void Main(string[] args) { //set some employee vatiable that we can pass to the constructors //employee 1 string firstname = "homer"; string lastname = "simpson"; string phoneno = "02078970111"; decimal salary = 50000M; int vacationdays = 25; Employee FT1 = new FullTimeEmployee("homer", "simpson", "8082546085", 50000M, 25); Console.WriteLine(FT1.ToString()); FT1.RunPayroll(); //employee 2 string firstname1 = "bart"; string lastnam1e = "simpson"; string phoneno1 = "02078970112"; decimal rate = 25m; int vacationdays1 = 5; PartTimeEmployee PT1 = new PartTimeEmployee("bart", "simpson", "808256999", 15.00M); PT1.RunPayroll(); }
static void Main(string[] args) { FullTimeEmployee fullTimeEmployee = new FullTimeEmployee(); fullTimeEmployee.FirstName = "Full time"; fullTimeEmployee.LastName = "Employee"; fullTimeEmployee.printFullName(); //PartTimeEmployee partTimeEmployee = new PartTimeEmployee();//it calls the derived class sepcific member Employee partTimeEmployee = new PartTimeEmployee();/* Base class variable referencing instance of child class, * calls the hidden base class member*/ partTimeEmployee.FirstName = "Part time"; partTimeEmployee.LastName = "Employee"; partTimeEmployee.printFullName(); /* Calls the member specific to this class when Derived class referencing derived class * instance, when base class variable reference instance of child class - will call * hidden method of base class -- see above*/ fullTimeEmployee.printFirstName(); //Should call the base class method, since not overriden/hidden partTimeEmployee.printFirstName(); //Should call the overriden member from child class Console.ReadKey(); }
static void Main(string[] args) { //add employee 1 to full time employee var employee1 = new FullTimeEmployee { FirstName = "Bill", LastName = "Gates", YearsEmployed = 5 }; //checks to ensure is true Debug.Assert(employee1.ShowFullName() == "Bill Gates"); Debug.Assert(employee1.YearsEmployed == 5); //add employee 2 to part time employee var employee2 = new PartTimeEmployee { FirstName = "Steve", LastName = "Jobs", MonthsEmployed = 2 }; //checks to ensure is true Debug.Assert(employee2.ShowFullName() == "Steve Jobs"); Debug.Assert(employee2.MonthsEmployed == 2); }
static void Main() { FullTimeEmployee ful = new FullTimeEmployee("Duke", 25, "Male", 1001, 500, 10); Console.WriteLine("------------Employee Details Display-------"); // ful.DisplayEmployee(); Console.WriteLine("------------Salary Calculated-------"); ful.CalculateSalary(); GC.Collect(); Console.ReadLine(); }
static void Main() { //Employee employee = new Employee("SAI", 25, "Male", 1001,500); //employee.DisplayEmployee(); FullTimeEmployee fullTimeEmployee = new FullTimeEmployee("SAI", 25, "Male", 1001, 500, 10); fullTimeEmployee.DisplayEmployee(); fullTimeEmployee.CalculateSalary(); GC.Collect(); Console.Read(); }
static void Main(string[] args) { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.firstName = "Ram"; FTE.lastName = "prasad"; FTE.yearlySalary = 50000; FTE.PrintFullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.firstName = "sachin"; PTE.lastName = "tendulkar"; PTE.commission = 40; PTE.PrintFullName(); }
public static void Main() { FullTimeEmployee employeeOne = new FullTimeEmployee(); employeeOne.firstName = "Ivan"; employeeOne.lastName = "Georgiev"; employeeOne.PrintFullName(); PartTimeEmployee employeeTwo = new PartTimeEmployee(); employeeTwo.firstName = "Tsvetan"; employeeTwo.lastName = "Salkin"; employeeTwo.PrintFullName(); }
static void Main(string[] args) { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "First FTE"; FTE.LastName = "Last FTE"; FTE.YearlySalary = 50000; FTE.PrintFullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "First PTE"; PTE.LastName = "Last PTE"; PTE.HourlySalary = 10; PTE.PrintFullName(); }
static void Main() { //Employee Emp = new Employee("Bhupesh",22,"Male",1001,30000); //Emp.DisplayEmp(); FullTimeEmployee FTE = new FullTimeEmployee("Bhupesh", 22, "Male", 1001, 3400, 95); FTE.CalSalary(); PartTimeEmployee PTE = new PartTimeEmployee("Akshay", 23, "Male", 1002, 3700, 67); PTE.CalSalary(); GC.Collect(); Console.ReadLine(); }
static void Main(string[] args) { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "Praveen"; FTE.LastName = "Prajapati"; FTE.yearlySalary = 50000f; FTE.PrintFullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "Chandan"; PTE.LastName = "Prajapati"; PTE.HourlyRate = 407; PTE.PrintFullName(); }
static void Main(string[] args) { FullTimeEmployee bill = new FullTimeEmployee(); bill.FirstName = "Bill"; bill.LastName = "Gates"; bill.YearsEmployed = 5; ContractEmployee steve = new ContractEmployee(); steve.FirstName = "Steve"; steve.LastName = "Jobs"; steve.MonthsEmployed = 2; Console.WriteLine("{0} has been employed for {1} years", bill.ShowFullName(), bill.YearsEmployed); Console.WriteLine("{0} has been employed for {1} months", steve.ShowFullName(), steve.MonthsEmployed); Console.ReadLine(); }
static void Main(string[] args) { /* * Inheritance * It is a kind of relationship between one or more classes, which allows to inherit code from one class to other */ // base class is referred to as parent or super class // derived class is referred to as child class /* One of the advantage of inheritance is code re usability */ // Single Inheritance // Hierarchical Inheritance // Multi Level Inheritance // Multiple Inheritance (not supported by .NET instead we have to go with interface to acheive this) FullTimeEmployee fte = new FullTimeEmployee(); fte.fname = "Anwesh"; fte.lname = "P"; fte.email = "*****@*****.**"; fte.yearlysalary = 100000; Console.WriteLine(fte.fname); Console.WriteLine(fte.lname); Console.WriteLine(fte.email); Console.WriteLine(fte.yearlysalary); fte.PrintFullName(); PartTimeEmployee pte = new PartTimeEmployee(); pte.fname = "Anwesh1"; pte.lname = "P1"; pte.email = "*****@*****.**"; pte.hourlysalary = 800; Console.WriteLine(pte.fname); Console.WriteLine(pte.lname); Console.WriteLine(pte.email); Console.WriteLine(pte.hourlysalary); Console.ReadLine(); }
public static void Main() { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "Aniket"; FTE.LastName = "Dharmadhikari"; FTE.YearlySalary = 500000; FTE.PrintFullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "Tinki"; PTE.LastName = "Dharmadhikari"; PTE.HourlySalary = 200000; PTE.PrintFullName(); }
static void Main(string[] args) { FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "Rajiv"; FTE.LastName = "Meheta"; FTE.Email = "*****@*****.**"; FTE.YearlySalary = 20000; FTE.PrintFullName(); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "Rohan"; PTE.LastName = "Singh"; PTE.Email = "*****@*****.**"; PTE.HourlyRate = 5000; PTE.PrintFullName(); Console.Read(); }
static void Main(string[] args) { var bill = new FullTimeEmployee { FirstName = "Bill", LastName = "Gates", YearsEmployed = 5 }; var steve = new ContractEmployee { FirstName = "Steve", LastName = "Jobs", MonthsEmployed = 2 }; Debug.Assert(bill.ShowFullName()== "Bill Gates", "This is not Bill's full name!!!!"); Debug.Assert(bill.YearsEmployed == 5); Debug.Assert(steve.ShowFullName() == "Steve Jobs", "This is not Steve's full name!!!!"); Debug.Assert(steve.MonthsEmployed == 2); }
static void Main(string[] args) { FullTimeEmployee emp1 = new FullTimeEmployee { FirstName = "Bill", LastName = "Gates", YearsEmployed = 5 }; ContractEmployee emp2 = new ContractEmployee { FirstName = "Steve", LastName = "Jobs", MonthsEmployed = 2 }; Debug.Assert(emp1.ShowFullName() == "Bill Gates", "His name is Bill Gates."); Debug.Assert(emp1.YearsEmployed == 5, "He's worked here 5 years."); Debug.Assert(emp2.ShowFullName() == "Steve Jobs", "His name is Steve Jobs."); Debug.Assert(emp2.MonthsEmployed == 2, "He's worked here 2 months."); }
static void Main(string[] args) { FullTimeEmployee bill = new FullTimeEmployee { FirstName = "Bill", LastName = "Gates", YearsEmployed = 5 }; ContractEmployee steve = new ContractEmployee { FirstName = "Steve", LastName = "Jobs", MonthsEmployed = 2 }; Debug.Assert(bill.ShowFullName() == "Bill Gates", "Wrong Person!"); Debug.Assert(bill.YearsEmployed == 5, "Wrong Employment History!"); Debug.Assert(steve.ShowFullName() == "Steve Jobs", "Wrong Person!"); Debug.Assert(steve.MonthsEmployed == 2, "Wrong Employment History!"); }
static void Main(string[] args) { //Inheritance allows for code re-use //c# suuports single inheritence //Multi level inheritance is allowed //Parent class constructors are executed before //child class constructors FullTimeEmployee fte = new FullTimeEmployee(); fte.FirstName = "seefeesaw"; fte.LastName = "shongwe"; fte.YearlySalary = 5000000; fte.PrintFullName(); PartTimeEmployee pte = new PartTimeEmployee(); pte.FirstName = "seefeesaw"; pte.LastName = "shongwe"; pte.HourlyRate = 1250; pte.PrintFullName(); }
static void Main(string[] args) { FullTimeEmployee bill = new FullTimeEmployee { FirstName = "Bill", LastName = "Gates", YearsEmployed = 5 }; Debug.Assert(bill.ShowFullName() == "Bill Gates", "Employee's name is Bill Gates"); Debug.Assert(bill.YearsEmployed == 5, "Employee has been working for 5 years!"); ContractEmployee steve = new ContractEmployee { FirstName = "Steve", LastName = "Jobs", MonthsEmployed = 2 }; Debug.Assert(steve.ShowFullName() == "Steve Jobs", "Employee's name is Steve Jobs"); Debug.Assert(steve.MonthsEmployed == 2, "Employee has been working for 2 months!"); Console.ReadLine(); }
static void Main(string[] args) { Employee e = new Employee(); e.firstName = "Chanandolor"; e.lastName = "Bong"; e.printFullName(); e = new FullTimeEmployee(); e.firstName = "Chanandolor"; e.lastName = "Bong"; e.printFullName(); e = new ContractEmployee(); e.firstName = "Chanandolor"; e.lastName = "Bong"; e.printFullName(); ContractEmployee c = new ContractEmployee(); c.firstName = "Chanandolor"; c.lastName = "Bong"; c.printFullName(); Console.Read(); }
static void Main(string[] args) { Console.WriteLine("Full Time Employee"); FullTimeEmployee FTE = new FullTimeEmployee(); FTE.FirstName = "Amol"; FTE.LastName = "Bhagat"; FTE.Email = "*****@*****.**"; FTE.YearlySalary = 300000; FTE.PrintData(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Part Time Employee"); PartTimeEmployee PTE = new PartTimeEmployee(); PTE.FirstName = "Csharp"; PTE.LastName = "Programming"; PTE.Email = "*****@*****.**"; PTE.HourlyRate = 100; PTE.PrintData(); Console.ReadKey(); }
private static void Main(string[] args) { FullTimeEmployee fte = new FullTimeEmployee(120000f, "james"); FullTimeEmployee fte1 = new FullTimeEmployee(); }