-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
41 lines (34 loc) · 1.06 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
using System;
using System.Collections;
namespace LabA
{
class Program
{
private readonly static FileOuput outFile = new FileOuput("animals.txt");
private readonly static FileInput inFile = new FileInput("animals.txt");
static void Main(string[] args)
{
ArrayList zoo = new ArrayList();
GatherInput inputGatherer = new GatherInput(zoo);
inputGatherer.GetUserInput();
foreach (ITalkable thing in zoo)
{
Printout(thing);
}
outFile.FileClose();
inFile.FileRead();
inFile.FileClose();
FileInput indata = new FileInput("animals.txt");
string line;
while ((line = indata.FileReadLine()) != null)
{
Console.WriteLine(line);
}
}
public static void Printout(ITalkable p)
{
Console.WriteLine($"{p.GetName()} says= {p.Talk()}");
outFile.FileWrite($"{p.GetName()} | {p.Talk()}");
}
}
}