-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResistorColor.java
More file actions
35 lines (32 loc) · 828 Bytes
/
Copy pathResistorColor.java
File metadata and controls
35 lines (32 loc) · 828 Bytes
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
class ResistorColor {
String[] colors = {"black","brown","red","orange","yellow","green","blue","violet","grey","white"};
int colorCode(String color) {
switch(color){
case "black":
return 0;
case "brown":
return 1;
case "red":
return 2;
case "orange":
return 3;
case "yellow":
return 4;
case "green":
return 5;
case "blue":
return 6;
case "violet":
return 7;
case "grey":
return 8;
case "white":
return 9;
default:
return 99;
}
}
String[] colors() {
return colors;
}
}