12일차 클래스(4)
Console Programming/C# Console 2019. 10. 8. 08:48
|
Program.cs |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { class Program { static void Main(string[] args) { new App(); } } }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
|
App.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 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { public class App { public App() { var pC1 = new PC("PBGA_01"); var mainBoard1 = new MainBoard("MSI A320M-A PRO"); var memoryCard1 = new MemoryCard("Samsung 8GB PC4-21300"); var soundCard1 = new SoundCard("Internal SoundCard");
Console.WriteLine($"조립 컴퓨터 {pC1.GetPCName()}을 생성했습니다.");
pC1.SetMainBoard(mainBoard1); Console.WriteLine($"{mainBoard1.GetMainBoardName()}"); pC1.SetMemorycard(memoryCard1); Console.WriteLine($"{memoryCard1.GetMemoryCardName()}"); pC1.SetSoundCard(soundCard1); Console.WriteLine($"{soundCard1.GetSoundCardName()}");
} } }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
|
PC.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 57 58 59 60 61 62 63 64 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { public class PC { //data //name //MemoryCard //SoundCard //MainBoard string name; MemoryCard memoryCard; SoundCard soundCard; MainBoard mainBoard; public PC(string name) { this.name = name; } //function //GetPCName //SetMemorycard //GetMemorycard //SetSoundCard //GetSoundCard //SetMainBoard //GetMainboard public string GetPCName() { return this.name; } public void SetMemorycard(MemoryCard memoryCard) { this.memoryCard = memoryCard; } public MemoryCard GetMemoryCard() { return this.memoryCard; } public void SetSoundCard(SoundCard soundCard) { this.soundCard = soundCard; } public SoundCard GetSoundCard() { return this.soundCard; } public void SetMainBoard(MainBoard mainBoard) { this.mainBoard = mainBoard; } public MainBoard GetMainboard() { return this.mainBoard; }
} }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
|
MainBoard.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 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { public class MainBoard { //data //name string name; public MainBoard(string name) { this.name = name; } public string GetMainBoardName() { return this.name; }
} }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
|
MemoryCard.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 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { public class MemoryCard { //data //name string name; public MemoryCard(string name) { this.name = name; } public string GetMemoryCardName() { return this.name; } } }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
|
Soundcard.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 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace PC { public class SoundCard { //data //name string name; public SoundCard(string name) { this.name = name; } public string GetSoundCardName() { return this.name; } } }
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter |
'Console Programming > C# Console' 카테고리의 다른 글
14일차 배열, 인벤토리에 아이템배열을 넣고, 인벤토리에 메서드 구현하기 (0) | 2019.10.10 |
---|---|
14일차 배열의 선언 및 초기화. cost와 name 멤버변수를 가진 클래스 product (0) | 2019.10.10 |
12일차 클래스(3) (0) | 2019.10.08 |
12일차 클래스(2) (0) | 2019.10.08 |
12일차 클래스 2차원 위치정보 (0) | 2019.10.08 |