|
@@ -1,104 +0,0 @@
|
1
|
|
-
|
2
|
|
-/**
|
3
|
|
- * Write a description of class SwitchModes here.
|
4
|
|
- *
|
5
|
|
- * @author (your name)
|
6
|
|
- * @version (a version number or a date)
|
7
|
|
- */
|
8
|
|
-public class SwitchModes
|
9
|
|
-{
|
10
|
|
- // instance variables - replace the example below with your own
|
11
|
|
- private int displayMode=1;
|
12
|
|
- private int unitMode=1;
|
13
|
|
-
|
14
|
|
- SwitchModes sm = new SwitchModes();
|
15
|
|
-
|
16
|
|
- public int getDisplayMode(){
|
17
|
|
- return displayMode;
|
18
|
|
- }
|
19
|
|
-
|
20
|
|
- public void setDisplayMode(int mode){
|
21
|
|
- displayMode=mode;
|
22
|
|
- }
|
23
|
|
-
|
24
|
|
- public int getUnitMode(){
|
25
|
|
- return unitMode;
|
26
|
|
- }
|
27
|
|
-
|
28
|
|
- public void setUnitMode(int mode){
|
29
|
|
- unitMode=mode;
|
30
|
|
- }
|
31
|
|
-
|
32
|
|
- /**
|
33
|
|
- * Constructor for objects of class SwitchModes
|
34
|
|
- */
|
35
|
|
- public SwitchModes()
|
36
|
|
- {
|
37
|
|
- // initialise instance variables
|
38
|
|
- }
|
39
|
|
-
|
40
|
|
- /**
|
41
|
|
- * An example of a method - replace this comment with your own
|
42
|
|
- *
|
43
|
|
- * @param y a sample parameter for a method
|
44
|
|
- * @return the sum of x and y
|
45
|
|
- */
|
46
|
|
-
|
47
|
|
- public void switchDisplayMode (String mode){
|
48
|
|
- mode.toLowerCase();
|
49
|
|
- switch (mode) {
|
50
|
|
- case "hex": {
|
51
|
|
- displayMode=1;
|
52
|
|
- // call update display
|
53
|
|
- break;
|
54
|
|
- }
|
55
|
|
- case "bin": {
|
56
|
|
- displayMode=2;
|
57
|
|
- // call update display
|
58
|
|
- break;
|
59
|
|
- }
|
60
|
|
- case "dec": {
|
61
|
|
- displayMode=3;
|
62
|
|
- // call update display
|
63
|
|
- break;
|
64
|
|
- }case "oct": {
|
65
|
|
- displayMode=4;
|
66
|
|
- // call update display
|
67
|
|
- break;
|
68
|
|
- }
|
69
|
|
- }
|
70
|
|
- }
|
71
|
|
-
|
72
|
|
- public void switchDisplayMode(){
|
73
|
|
- if (displayMode==4){
|
74
|
|
- displayMode=1;
|
75
|
|
- // call update display
|
76
|
|
- }
|
77
|
|
- else {
|
78
|
|
- displayMode++;
|
79
|
|
- // call update display
|
80
|
|
- }
|
81
|
|
-
|
82
|
|
- }
|
83
|
|
-
|
84
|
|
- public void switchUnitsMode (String mode){
|
85
|
|
- if (mode.toLowerCase()=="degrees") {
|
86
|
|
- unitMode=1;
|
87
|
|
-
|
88
|
|
- } else if(mode.toLowerCase()=="radians")
|
89
|
|
- unitMode=2;
|
90
|
|
-
|
91
|
|
- }
|
92
|
|
- public void switchUnitsMode(){
|
93
|
|
- if (unitMode==2){
|
94
|
|
- unitMode=1;
|
95
|
|
- // call update display
|
96
|
|
- }
|
97
|
|
- else {
|
98
|
|
- unitMode++;
|
99
|
|
- // call update display
|
100
|
|
- }
|
101
|
|
-
|
102
|
|
- }
|
103
|
|
-
|
104
|
|
-}
|