Assignment4

연습문제 Ex4 (Due by 10/15 목 24시까지)
-cyber 강의실 (cyber.dku.edu)로 source code, executable file, solution/project VC# file, 보고서를 학번_이름_Ex4.zip으로 묶어서 낼 것. 보고서 (30%)1252035235.hwp


[연습문제]
1. PersonManager 클래스는 리스트를 데이터 멤버로 포함한다. (30%)
http://msdn.microsoft.com/en-us/library/system.collections.aspx
– private List<Person> pList;
그리고 메소드는 다음을 포함한다.
– public void Add(Person p)  // 리스트에 Person을 추가
– public void Remove(Person p) // 리스트에 Person을 제거
– public void Clear()   // 리스트에 모든 Person 제거
– public int IndexOf(Person p) // 리스트에 Person의 index 반환
– public int GetCount()   // 리스트에 Person의 개수 반환
– public void Sort()   // 리스트에 Person의 이름 순서로 정렬
– public Person this[int index]  // 리스트의 indexer


// 리스트에 모든 Person, Student, Faculty를 출력
// pList.ForEach에 각각의 Print를 출력하는 Action delegate 사용
– public void Print()


// 리스트에서 Person인 경우만 새로운 리스트로 만들어서 List<Person> 반환
// pList.FindAll에 Person인지 아닌지를 알려주는 Predicate delegate 사용
– public List<Person> GetPersonList()


// 리스트에서 Student인 경우만 새로운 리스트로 만들어서 List<Student> 반환
// pList.FindAll에 Student인지 아닌지를 알려주는 Predicate delegate 사용
// pList.ConvertAll에 Person을 Student로 바꿔주는 Converter delegate 사용
– public List<Student> GetStudentList()


// 리스트에서 Faculty인 경우만 새로운 리스트로 만들어서 List<Faculty> 반환
// pList.FindAll에 Faculty인지 아닌지를 알려주는 Predicate delegate 사용
// pList.ConvertAll에 Person을 Faculty로 바꿔주는 Converter delegate 사용
– public List<Faculty> GetFacultyList()
2. PersonManager 클래스에 다음 File I/O 메소드를 포함한다. (10%)
// cvs(comma separated value) 텍스트를 읽어서 pList에 추가
// StreamReader 사용
– public void LoadFile(string path)


// pList의 모든 원소를 cvs(comma separated value) 텍스트로 저장
// StreamWriter 사용
– public void WriteFile(string path)


// Test.csv 파일
Park Kyoung Shin, 1207, 041-550-3469, 3과417
조흥목, 5205, 010, 2과317, 70, 80, 90
김승훈, 1202, 041-550-3481, 3과420, 멀티미디어공학
박태근, 1204, 041-550-3486, 3과419
박정서, 5204, 041-550-3490, 2과320, 80, 80, 80


3. Person 클래스는 IComparable, IEquatable 인터페이스를 상속받고 다음 메소드를 추가한다. (10%)
– public override string ToString()  // System.Object.ToString method override
– public int CompareTo(Person other)  // Person 이름 순서대로 비교
– public bool Equals(Person other)  // ==


Student 클래스는 IComparable, IEquatable 인터페이스를 상속받고 다음 메소드를 추가한다.
– public override string ToString()  // System.Object.ToString method override
– public int CompareTo(Student other)  // Student 성적 순서대로 비교
– public bool Equals(Student other)  // ==


Faculty 클래스는 IEquatable 인터페이스를 상속받고 다음 메소드를 추가한다.
– public override string ToString()  // System.Object.ToString method override
– public bool Equals(Student other)  // ==


4. PersonListFileIO 클래스의 Main 함수에서는 PersonManager 객체를 생성하고 메소드를 모두 테스트한다. (10%)
– LoadFile를 사용하여 리스트에 데이터를 로딩
– Sort를 사용하여 리스트의 데이터를 정렬 (사람의 이름 순서대로)하고 Print로 출력
– Add와 Remove 등을 사용하여 5명 이상 Person, Student, Faculty 추가 또는 제거하고 Print로 출력
– GetPersonList, GetStudentList, GetFacultyList로 각 Perosn, Student, Faculty 리스트별로 모든 내용을 출력
– WriteFile를 사용하여 리스트에 있는 모든 데이터를 저장


5. Person, Student, Faculty, PersonManager 클래스 또는 Main 함수에서 본인이 더 테스트해보고 싶은 Method를 추가하라. (10%)

Leave a Reply

Your email address will not be published. Required fields are marked *