-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (45 loc) · 1.29 KB
/
Program.cs
File metadata and controls
54 lines (45 loc) · 1.29 KB
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
using System;
class Program
{
static void Main(string[] args)
{
KodePos table_Kodepos = new KodePos();
Console.WriteLine("=== GET KODE POS BATUNUNGGAL===");
table_Kodepos.getKodepos("Batununggal");
Console.WriteLine("==== GET ALL KODE POS ====");
table_Kodepos.getAllkodepos();
}
}
class KodePos
{
Dictionary<string, string> dic = new Dictionary<string, string>() {
{"Batununggal","40266"},
{"Kujangsari","40287"},
{"Mengger" ,"40267"},
{"Wates" ,"40256"},
{"Cijaura" ,"40287"},
{"Jatisari" ,"40286"},
{"Margasari","40286"},
{"Sekejati" ,"40286"},
{"Kebonwaru","40272"},
{"Maleer" ,"40274"},
{"Samoja" ,"40273"} };
public void getKodepos(string kel)
{
if (dic.ContainsKey(kel))
{
Console.WriteLine(kel + " : " + dic[kel]);
}
else
{
Console.WriteLine(kel + " tidak ditemukan");
}
}
public void getAllkodepos()
{
foreach (KeyValuePair<string, string> ele1 in dic)
{
Console.WriteLine("{0} \t\t {1}", ele1.Key, ele1.Value);
}
}
}