티스토리 뷰
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
public class Student
{
private string name;
private string hakbun;
private string phone_num;
private string grade;
public Student(string Hakbun, string Name, string Phone_num)
{
this.hakbun = Hakbun;
this.name = Name;
this.phone_num = Phone_num;
}
public string G_Hakbun
{
get { return this.hakbun; }
}
public string GS_Name
{
get { return this.name; }
set { this.name = value; }
}
public string GS_Phone_num
{
get { return this.phone_num; }
set { this.phone_num = value; }
}
public string GS_grade
{
get { return this.grade; }
set { this.grade = value; }
}
}
public class Teacher
{
private string name;
private string sabun;
private string phone_num;
public Teacher(string Sabun, string Name, string Phone_num)
{
this.sabun = Sabun;
this.name = Name;
this.phone_num = Phone_num;
}
public string G_Name
{
get { return this.name;}
set { this.name = value; }
}
public string G_Sabun
{
get { return this.sabun; }
}
public string Phone_num
{
get { return this.phone_num; }
set { this.phone_num = value; }
}
}
public class Subject
{
private string num;
private string sub_name;
private string sub_what;
public string G_Num
{
get { return this.num; }
}
public string G_Sub_name
{
get { return this.sub_name; }
}
public string G_Sub_what
{
get { return this.sub_what; }
set { this.sub_what = value; }
}
public Subject(string Num, string Sub_name, string Sub_what)
{
this.num = Num;
this.sub_name = Sub_name;
this.sub_what = Sub_what;
}
}
public class Course
{
private Subject subject;
private Teacher teacher;
private Student[] students;
private int studentCurrentNumber;
private int studentMaxNumber;
public Course(int no, Subject sub, Teacher tc)
{
this.studentMaxNumber = no;
this.students = new Student[this.studentMaxNumber];
this.studentCurrentNumber = 0;
this.subject = sub;
this.teacher = tc;
}
public Teacher GetTeacher()
{
return this.teacher;
}
public Student[] GetStudents()
{
return this.students;
}
public Subject GetSubject()
{
return this.subject;
}
public void AddStudent(Student std)
{
if (this.studentCurrentNumber < this.studentMaxNumber)
{
students[this.studentCurrentNumber++] = std;
Console.WriteLine("현재 학생 수는 " + this.studentCurrentNumber + "입니다.");
}
else
{
Console.WriteLine("[정원초과] 현재 학생수 : " + this.studentCurrentNumber);
}
}
}
class MainApp
{
static void Main(string[] args)
{
Teacher tc = new Teacher("091111", "김강사씨", "010-0000-1111");
Subject sj = new Subject("CS0823", "C#프로그래밍", "C#을 통해서 객체지향을 이해하자");
Course cs = new Course(3, sj, tc);
Student std;
std = new Student("120012", "김학생씨", "010-1111-1111");
cs.AddStudent(std);
std = new Student("120013", "이학생씨", "010-1111-1111");
cs.AddStudent(std);
std = new Student("120014", "박학생씨", "010-1111-1111");
cs.AddStudent(std);
std = new Student("120015", "최학생씨", "010-1111-1111");
cs.AddStudent(std);
foreach (Student s in cs.GetStudents())
{
Console.WriteLine(s.GS_Name);
}
}
}
}
'IT Skills > Programming' 카테고리의 다른 글
C# - 시험참고자료#` (0) | 2013.04.22 |
---|---|
java 계산기 (0) | 2013.04.15 |
Linux vi편집기 사용법(한글깨짐오류처리방법포함)&&telnet 기본적인 사용법 (0) | 2013.04.02 |
JAVA - 오목 만들어보기 2 (0) | 2013.04.01 |
JAVA - 오목 만들어보기 1 (0) | 2013.04.01 |
- Total
- Today
- Yesterday
- 윈도우즈 10
- ps4
- 카카오프렌즈
- 아이폰X
- 디지바이스
- 애드센스
- 프라모델
- 프로그래밍
- Windows 10
- 건담
- javascript
- razer
- 라이언
- m5a97
- 플스2
- 이어폰
- 일본
- 디지몬
- AMD
- 구글
- Asus
- 듀얼쇼크4
- 피규어
- 일본여행
- PS2
- 고양이
- 안산
- 노트북
- 마우스
- 보스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |