Last active
September 17, 2020 17:48
-
-
Save Adobe-Android/b89002b08fc1d830cc263e8db0967a7d to your computer and use it in GitHub Desktop.
Employee interface and implementation (in one file for convenience)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
interface IEmployee | |
{ | |
string Id { get; set; } | |
string FullName { get; set; } | |
string Email { get; set; } | |
string Phone { get; set; } | |
string Company { get; } | |
} | |
public class Employee : IEmployee | |
{ | |
// Just used for our example, we assume that everyone here works for the same company so we can set this for all employees. | |
public static string companyName = "Bangazon"; | |
public string Id { get; set; } | |
public string FullName { get; set; } | |
public string Email { get; set; } | |
public string Phone { get; set; } | |
public string Company => companyName; | |
} | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Employee employee = new Employee(); | |
Console.Write("Enter the new employee id: "); | |
employee.Id = Console.ReadLine(); | |
Console.Write("Enter the new employee name: "); | |
employee.FullName = Console.ReadLine(); | |
Console.Write("Enter the new employee email: "); | |
employee.Email = Console.ReadLine(); | |
Console.Write("Enter the new employee phone: "); | |
employee.Phone = Console.ReadLine(); | |
Console.WriteLine(":---------------------------:"); | |
Console.WriteLine("The employee information:"); | |
Console.WriteLine("Employee id: {0}", employee.Id); | |
Console.WriteLine("Employee name: {0}", employee.FullName); | |
Console.WriteLine("Employee email: {0}", employee.Email); | |
Console.WriteLine("Employee phone: {0}", employee.Phone); | |
Console.WriteLine("Employee company: {0}", employee.Company); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment