-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskList.cs
56 lines (47 loc) · 1.23 KB
/
TaskList.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
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Choose_Your_Class
{
public class TaskList
{
public List<Task> MyList = new List<Task>();
string divider = new string('-', 30);
public void AddTask(Task newTask)
{
// adds task to the task list
MyList.Add(newTask);
}
public void RemoveTask(Task chosenTask)
{
// removes task from the task list
MyList.Remove(chosenTask);
}
public Task ChooseTask()
{
// chooses a task to be acted upon
Console.WriteLine("Select a task:");
for (int i = 0; i < MyList.Count; i++)
{
Console.WriteLine(i+1 + "." + MyList[i].Description);
}
int index = Convert.ToInt32(Console.ReadLine())-1;
return MyList[index];
}
public void getStatusAll()
{
Console.WriteLine("Task Status List");
Console.WriteLine(divider);
Console.WriteLine("Due Date\tImportance\tUrgency\t\tComplete?");
for (int i = 0; i < MyList.Count; i++)
{
Console.WriteLine($"Descr: {MyList[i].Description}");
Console.WriteLine($"{MyList[i].DueDate}\t\t{MyList[i].Importance}\t\t{MyList[i].Urgency}\t\t{MyList[i].IsComplete}");
Console.WriteLine();
}
Console.ReadLine();
}
}
}