-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (44 loc) · 1.54 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
namespace CatWorx.BadgeMaker
{
class Program
{
static List<Employee> GetEmployees()
{
List<Employee> employees = new List<Employee>();
while (true)
{
Console.WriteLine("Please enter a name: (leave empty to exit): ");
string firstName = Console.ReadLine();
if (firstName == "")
{
break;
}
Console.Write("Enter last name: ");
string lastName = Console.ReadLine();
Console.Write("Enter ID: ");
int id = Int32.Parse(Console.ReadLine());
Console.Write("Enter Photo URL: ");
string photoUrl = Console.ReadLine();
// Create a new Employee instance
Employee currentEmployee = new Employee(firstName, lastName, id, photoUrl);
employees.Add(currentEmployee);
}
return employees;
}
static void PrintEmployees(List<Employee> employees)
{
for (int i = 0; i < employees.Count; i++)
{
string template = "{0,-10}\t{1,-20}\t{2}";
Console.WriteLine(String.Format(template, employees[i].GetId(), employees[i].GetName(), employees[i].GetPhotoUrl()));
}
}
static void Main(string[] args)
{
List<Employee> employees = GetEmployees();
PrintEmployees(employees);
}
}
}