Skip to content

Instantly share code, notes, and snippets.

@Adobe-Android
Last active September 17, 2020 17:48
Show Gist options
  • Save Adobe-Android/b89002b08fc1d830cc263e8db0967a7d to your computer and use it in GitHub Desktop.
Save Adobe-Android/b89002b08fc1d830cc263e8db0967a7d to your computer and use it in GitHub Desktop.
Employee interface and implementation (in one file for convenience)
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