-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChipFactory.java
57 lines (54 loc) · 1.39 KB
/
ChipFactory.java
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class ChipFactory here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ChipFactory {
public enum Values{
Five,
Ten,
Twenty,
Fifty
}
public static Chip createChip(int values )
{
//values= NumberInputBox.getValue();
Chip chip = null;
switch( values ) {
case 5:
chip= new Chip ("FiveChip.PNG", 5);
break;
case 10:
chip= new Chip ("TenChip.PNG", 10);
break;
case 20:
chip= new Chip ("TwentyChip.PNG", 20);
break;
case 50:
chip= new Chip ("FiftyChip.PNG", 50);
break;
}
return chip;
}
public static ChipTwo createChipTwo(int values )
{
ChipTwo chip = null;
switch( values ) {
case 5:
chip= new ChipTwo ("FiveChip2.PNG", 5);
break;
case 10:
chip= new ChipTwo ("TenChip2.PNG", 10);
break;
case 20:
chip= new ChipTwo ("TwentyChip2.PNG", 20);
break;
case 50:
chip= new ChipTwo ("FiftyChip2.PNG", 50);
break;
}
return chip;
}
}