jpsp91 6 lat temu
rodzic
commit
2a2046dd39

BIN
.DS_Store Wyświetl plik


+ 9
- 0
.idea/ZCW-MesoLabs-Inheritance-ProductManager-BlueJ.iml Wyświetl plik

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$" />
6
+    <orderEntry type="inheritedJdk" />
7
+    <orderEntry type="sourceFolder" forTests="false" />
8
+  </component>
9
+</module>

+ 6
- 0
.idea/misc.xml Wyświetl plik

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+</project>

+ 8
- 0
.idea/modules.xml Wyświetl plik

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/ZCW-MesoLabs-Inheritance-ProductManager-BlueJ.iml" filepath="$PROJECT_DIR$/.idea/ZCW-MesoLabs-Inheritance-ProductManager-BlueJ.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml Wyświetl plik

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="" vcs="Git" />
5
+  </component>
6
+</project>

+ 259
- 0
.idea/workspace.xml Wyświetl plik

@@ -0,0 +1,259 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="b3548ae9-d47b-4f05-bbd9-daba9a525d39" name="Default" comment="">
5
+      <change beforePath="$PROJECT_DIR$/ProductTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/Test/ProductTest.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/package.bluej" beforeDir="false" afterPath="$PROJECT_DIR$/package.bluej" afterDir="false" />
7
+    </list>
8
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9
+    <option name="TRACKING_ENABLED" value="true" />
10
+    <option name="SHOW_DIALOG" value="false" />
11
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
12
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13
+    <option name="LAST_RESOLUTION" value="IGNORE" />
14
+  </component>
15
+  <component name="FileEditorManager">
16
+    <leaf>
17
+      <file leaf-file-name="MainApplication.class" pinned="false" current-in-tab="true">
18
+        <entry file="file://$PROJECT_DIR$/MainApplication.class">
19
+          <provider selected="true" editor-type-id="text-editor">
20
+            <state relative-caret-position="135">
21
+              <caret line="9" lean-forward="true" selection-start-line="9" selection-end-line="9" />
22
+              <folding>
23
+                <element signature="e#0#176#0" expanded="true" />
24
+              </folding>
25
+            </state>
26
+          </provider>
27
+        </entry>
28
+      </file>
29
+      <file leaf-file-name="Product.class" pinned="false" current-in-tab="false">
30
+        <entry file="file://$PROJECT_DIR$/Product.class">
31
+          <provider selected="true" editor-type-id="text-editor">
32
+            <state>
33
+              <folding>
34
+                <element signature="e#0#160#0" expanded="true" />
35
+              </folding>
36
+            </state>
37
+          </provider>
38
+        </entry>
39
+      </file>
40
+      <file leaf-file-name="ProductTest.class" pinned="false" current-in-tab="false">
41
+        <entry file="file://$PROJECT_DIR$/Test/ProductTest.class">
42
+          <provider selected="true" editor-type-id="text-editor">
43
+            <state relative-caret-position="135">
44
+              <caret line="9" lean-forward="true" selection-start-line="9" selection-end-line="9" />
45
+              <folding>
46
+                <element signature="e#0#168#0" expanded="true" />
47
+              </folding>
48
+            </state>
49
+          </provider>
50
+        </entry>
51
+      </file>
52
+    </leaf>
53
+  </component>
54
+  <component name="Git.Settings">
55
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
56
+  </component>
57
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
58
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
59
+  <component name="JsGulpfileManager">
60
+    <detection-done>true</detection-done>
61
+    <sorting>DEFINITION_ORDER</sorting>
62
+  </component>
63
+  <component name="NodePackageJsonFileManager">
64
+    <packageJsonPaths />
65
+  </component>
66
+  <component name="ProjectFrameBounds" extendedState="6">
67
+    <option name="x" value="-48" />
68
+    <option name="y" value="23" />
69
+    <option name="width" value="1356" />
70
+    <option name="height" value="721" />
71
+  </component>
72
+  <component name="ProjectView">
73
+    <navigator proportions="" version="1">
74
+      <foldersAlwaysOnTop value="true" />
75
+    </navigator>
76
+    <panes>
77
+      <pane id="ProjectPane">
78
+        <subPane>
79
+          <expand>
80
+            <path>
81
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="b2602c69:ProjectViewProjectNode" />
82
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="462c0819:PsiDirectoryNode" />
83
+            </path>
84
+            <path>
85
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="b2602c69:ProjectViewProjectNode" />
86
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="462c0819:PsiDirectoryNode" />
87
+              <item name=".idea" type="462c0819:PsiDirectoryNode" />
88
+            </path>
89
+            <path>
90
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="b2602c69:ProjectViewProjectNode" />
91
+              <item name="ZCW-MesoLabs-Inheritance-ProductManager-BlueJ" type="462c0819:PsiDirectoryNode" />
92
+              <item name="Test" type="462c0819:PsiDirectoryNode" />
93
+            </path>
94
+          </expand>
95
+          <select />
96
+        </subPane>
97
+      </pane>
98
+      <pane id="Scope" />
99
+      <pane id="PackagesPane" />
100
+      <pane id="AndroidView" />
101
+    </panes>
102
+  </component>
103
+  <component name="PropertiesComponent">
104
+    <property name="WebServerToolWindowFactoryState" value="false" />
105
+    <property name="aspect.path.notification.shown" value="true" />
106
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
107
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
108
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
109
+    <property name="settings.editor.selected.configurable" value="reference.projectsettings.compiler.javacompiler" />
110
+  </component>
111
+  <component name="RecentsManager">
112
+    <key name="MoveFile.RECENT_KEYS">
113
+      <recent name="$PROJECT_DIR$/Test" />
114
+    </key>
115
+  </component>
116
+  <component name="RunDashboard">
117
+    <option name="ruleStates">
118
+      <list>
119
+        <RuleState>
120
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
121
+        </RuleState>
122
+        <RuleState>
123
+          <option name="name" value="StatusDashboardGroupingRule" />
124
+        </RuleState>
125
+      </list>
126
+    </option>
127
+  </component>
128
+  <component name="RunManager">
129
+    <configuration default="true" type="Application" factoryName="Application">
130
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
131
+    </configuration>
132
+    <configuration default="true" type="JUnit" factoryName="JUnit">
133
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
134
+      <option name="ALTERNATIVE_JRE_PATH" />
135
+      <option name="PACKAGE_NAME" />
136
+      <option name="MAIN_CLASS_NAME" />
137
+      <option name="METHOD_NAME" />
138
+      <option name="TEST_OBJECT" value="class" />
139
+      <option name="VM_PARAMETERS" value="-ea" />
140
+      <option name="PARAMETERS" />
141
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
142
+      <option name="PASS_PARENT_ENVS" value="true" />
143
+      <option name="TEST_SEARCH_SCOPE">
144
+        <value defaultName="singleModule" />
145
+      </option>
146
+      <patterns />
147
+    </configuration>
148
+    <configuration default="true" type="TestNG" factoryName="TestNG">
149
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
150
+      <option name="ALTERNATIVE_JRE_PATH" />
151
+      <option name="SUITE_NAME" />
152
+      <option name="PACKAGE_NAME" />
153
+      <option name="MAIN_CLASS_NAME" />
154
+      <option name="METHOD_NAME" />
155
+      <option name="GROUP_NAME" />
156
+      <option name="TEST_OBJECT" value="CLASS" />
157
+      <option name="VM_PARAMETERS" value="-ea" />
158
+      <option name="PARAMETERS" />
159
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
160
+      <option name="OUTPUT_DIRECTORY" />
161
+      <option name="PASS_PARENT_ENVS" value="true" />
162
+      <option name="TEST_SEARCH_SCOPE">
163
+        <value defaultName="singleModule" />
164
+      </option>
165
+      <option name="USE_DEFAULT_REPORTERS" value="false" />
166
+      <option name="PROPERTIES_FILE" />
167
+      <properties />
168
+      <listeners />
169
+    </configuration>
170
+  </component>
171
+  <component name="SvnConfiguration">
172
+    <configuration />
173
+  </component>
174
+  <component name="TaskManager">
175
+    <task active="true" id="Default" summary="Default task">
176
+      <changelist id="b3548ae9-d47b-4f05-bbd9-daba9a525d39" name="Default" comment="" />
177
+      <created>1530229111003</created>
178
+      <option name="number" value="Default" />
179
+      <option name="presentableId" value="Default" />
180
+      <updated>1530229111003</updated>
181
+      <workItem from="1530229113066" duration="320000" />
182
+    </task>
183
+    <servers />
184
+  </component>
185
+  <component name="TimeTrackingManager">
186
+    <option name="totallyTimeSpent" value="320000" />
187
+  </component>
188
+  <component name="ToolWindowManager">
189
+    <frame x="0" y="23" width="1280" height="721" extended-state="6" />
190
+    <editor active="true" />
191
+    <layout>
192
+      <window_info anchor="right" id="Palette" />
193
+      <window_info anchor="bottom" id="TODO" order="6" />
194
+      <window_info anchor="right" id="Palette&#9;" />
195
+      <window_info id="Image Layers" />
196
+      <window_info anchor="right" id="Capture Analysis" />
197
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
198
+      <window_info anchor="right" id="Maven Projects" />
199
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
200
+      <window_info anchor="bottom" id="Run" order="2" />
201
+      <window_info anchor="bottom" id="Version Control" />
202
+      <window_info anchor="bottom" id="Terminal" />
203
+      <window_info id="Capture Tool" />
204
+      <window_info id="Designer" />
205
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14620355" />
206
+      <window_info anchor="right" id="Database" />
207
+      <window_info id="Learn" />
208
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
209
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
210
+      <window_info id="UI Designer" />
211
+      <window_info anchor="right" id="Theme Preview" />
212
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
213
+      <window_info id="Favorites" side_tool="true" />
214
+      <window_info anchor="bottom" id="Find" order="1" />
215
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
216
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
217
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
218
+      <window_info anchor="bottom" id="Message" order="0" />
219
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
220
+    </layout>
221
+  </component>
222
+  <component name="TypeScriptGeneratedFilesManager">
223
+    <option name="version" value="1" />
224
+  </component>
225
+  <component name="VcsContentAnnotationSettings">
226
+    <option name="myLimit" value="2678400000" />
227
+  </component>
228
+  <component name="editorHistoryManager">
229
+    <entry file="file://$PROJECT_DIR$/Test/ProductTest.class">
230
+      <provider selected="true" editor-type-id="text-editor">
231
+        <state relative-caret-position="135">
232
+          <caret line="9" lean-forward="true" selection-start-line="9" selection-end-line="9" />
233
+          <folding>
234
+            <element signature="e#0#168#0" expanded="true" />
235
+          </folding>
236
+        </state>
237
+      </provider>
238
+    </entry>
239
+    <entry file="file://$PROJECT_DIR$/Product.class">
240
+      <provider selected="true" editor-type-id="text-editor">
241
+        <state>
242
+          <folding>
243
+            <element signature="e#0#160#0" expanded="true" />
244
+          </folding>
245
+        </state>
246
+      </provider>
247
+    </entry>
248
+    <entry file="file://$PROJECT_DIR$/MainApplication.class">
249
+      <provider selected="true" editor-type-id="text-editor">
250
+        <state relative-caret-position="135">
251
+          <caret line="9" lean-forward="true" selection-start-line="9" selection-end-line="9" />
252
+          <folding>
253
+            <element signature="e#0#176#0" expanded="true" />
254
+          </folding>
255
+        </state>
256
+      </provider>
257
+    </entry>
258
+  </component>
259
+</project>

+ 11
- 0
Apple.java Wyświetl plik

@@ -0,0 +1,11 @@
1
+public class Apple extends Product {
2
+
3
+
4
+
5
+    public Apple(double price, int id, int quantityOnHand) {
6
+        super(price, id, quantityOnHand);
7
+    }
8
+
9
+
10
+
11
+}

+ 10
- 0
Banana.java Wyświetl plik

@@ -0,0 +1,10 @@
1
+public class Banana extends Product {
2
+
3
+
4
+    public Banana(double price, int id, int quantityOnHand) {
5
+        super(price, id, quantityOnHand);
6
+    }
7
+
8
+
9
+    
10
+}

+ 11
- 0
Coconut.java Wyświetl plik

@@ -0,0 +1,11 @@
1
+public class Coconut extends Product {
2
+
3
+
4
+
5
+    public Coconut(double price, int id, int quantityOnHand) {
6
+        super(price, id, quantityOnHand);
7
+    }
8
+
9
+
10
+
11
+}

+ 88
- 0
Inventory.java Wyświetl plik

@@ -0,0 +1,88 @@
1
+
2
+public class Inventory {
3
+
4
+
5
+
6
+
7
+Apple apple;
8
+
9
+Banana banana;
10
+
11
+Coconut coconut;
12
+
13
+
14
+public Inventory(){
15
+
16
+    apple = new Apple(5.00,1,500);
17
+    banana = new Banana(7.00, 2, 300);
18
+    coconut = new Coconut(12.00, 3,50);
19
+
20
+}
21
+
22
+
23
+
24
+
25
+public double sum(){
26
+
27
+    return (apple.price * apple.quantityOnHand) + (banana.price * banana.quantityOnHand) + (coconut.price * coconut.quantityOnHand);
28
+}
29
+
30
+
31
+public String priceList(){
32
+
33
+    StringBuilder sb = new StringBuilder();
34
+
35
+    String ap = "Apple: $" + apple.price + "\n";
36
+
37
+    String ba = "Banana: $" + banana.price + "\n";
38
+
39
+    String co = "Coconut: $" + coconut.price + "\n";
40
+
41
+
42
+    return String.valueOf(sb.append(ap + ba + co));
43
+}
44
+
45
+
46
+public String idList(){
47
+
48
+    StringBuilder sb = new StringBuilder();
49
+
50
+    String ap = "Apple id: " + apple.id + "\n";
51
+
52
+    String ba = "Banana id: " + banana.id + "\n";
53
+
54
+    String co = "Coconut id: " + coconut.id + "\n";
55
+
56
+
57
+    return String.valueOf(sb.append(ap + ba + co));
58
+}
59
+
60
+
61
+
62
+public String quantityList(){
63
+
64
+    StringBuilder sb = new StringBuilder();
65
+
66
+
67
+    String ap = "Apple quantity: " + apple.quantityOnHand + "\n";
68
+
69
+    String ba = "Banana quantity: " + banana.quantityOnHand + "\n";
70
+
71
+    String co = "Coconut quantity: " + coconut.quantityOnHand + "\n";
72
+
73
+
74
+    return String.valueOf(sb.append(ap + ba + co));
75
+}
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+}

+ 23
- 3
MainApplication.java Wyświetl plik

@@ -1,6 +1,26 @@
1 1
 
2
-/**
3
- * Created by leon on 1/10/18.
4
- */
2
+
5 3
 public class MainApplication {
4
+
5
+
6
+    public String managerTodd(){
7
+
8
+        Inventory inv = new Inventory();
9
+
10
+        StringBuilder sb = new StringBuilder();
11
+
12
+        String sum = "The sum price of all products: " + inv.sum() + "\n";
13
+
14
+        String price = "The price list of each products: \n" + inv.priceList() + "\n";
15
+
16
+        String quantity = "The quantitis of each products: \n" + inv.quantityList() + "\n";
17
+
18
+
19
+        return String.valueOf(sb.append(sum + price + quantity));
20
+    }
21
+
22
+
23
+
24
+
25
+
6 26
 }

+ 45
- 4
Product.java Wyświetl plik

@@ -1,7 +1,48 @@
1 1
 
2
+public class Product extends Inventory {
3
+
4
+
5
+
6
+    public Product(double price, int id, int quantityOnHand){
7
+        this.price = price;
8
+        this.id = id;
9
+        this.quantityOnHand = quantityOnHand;
10
+    }
11
+
12
+
13
+
14
+    public double price;
15
+
16
+    public double getPrice() {
17
+    return price;
18
+    }
19
+
20
+    public void setPrice(double price) {
21
+        price = price;
22
+    }
23
+
24
+
25
+    public int id;
26
+    public int getId() {
27
+        return  id;
28
+    }
29
+
30
+    public void setId(int id) {
31
+        this.id = id;
32
+    }
33
+
34
+
35
+    public int quantityOnHand;
36
+    public int getQuantityOnHand() {
37
+        return quantityOnHand;
38
+    }
39
+
40
+    public void setQuantityOnHand(int quantityOnHand) {
41
+        this.quantityOnHand = quantityOnHand;
42
+    }
43
+
44
+
45
+
46
+
2 47
 
3
-/**
4
- * Created by leon on 1/10/18.
5
- */
6
-public class Product {
7 48
 }

ProductTest.java → Test/ProductTest.java Wyświetl plik


+ 49
- 7
package.bluej Wyświetl plik

@@ -1,20 +1,20 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=722
3
-editor.fx.0.width=800
4
-editor.fx.0.x=560
5
-editor.fx.0.y=117
2
+editor.fx.0.height=0
3
+editor.fx.0.width=0
4
+editor.fx.0.x=0
5
+editor.fx.0.y=0
6 6
 objectbench.height=101
7 7
 objectbench.width=461
8 8
 package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.8007380073800738
10 10
 package.editor.height=427
11 11
 package.editor.width=674
12
-package.editor.x=141
13
-package.editor.y=59
12
+package.editor.x=368
13
+package.editor.y=119
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0
17
-package.numTargets=0
17
+package.numTargets=6
18 18
 package.showExtends=true
19 19
 package.showUses=true
20 20
 project.charset=UTF-8
@@ -23,3 +23,45 @@ readme.name=@README
23 23
 readme.width=47
24 24
 readme.x=10
25 25
 readme.y=10
26
+target1.height=50
27
+target1.name=Apple
28
+target1.showInterface=false
29
+target1.type=ClassTarget
30
+target1.width=80
31
+target1.x=90
32
+target1.y=10
33
+target2.height=50
34
+target2.name=Coconut
35
+target2.showInterface=false
36
+target2.type=ClassTarget
37
+target2.width=80
38
+target2.x=180
39
+target2.y=10
40
+target3.height=50
41
+target3.name=Product
42
+target3.showInterface=false
43
+target3.type=ClassTarget
44
+target3.width=80
45
+target3.x=120
46
+target3.y=180
47
+target4.height=50
48
+target4.name=Inventory
49
+target4.showInterface=false
50
+target4.type=ClassTarget
51
+target4.width=80
52
+target4.x=70
53
+target4.y=70
54
+target5.height=50
55
+target5.name=MainApplication
56
+target5.showInterface=false
57
+target5.type=ClassTarget
58
+target5.width=120
59
+target5.x=240
60
+target5.y=150
61
+target6.height=50
62
+target6.name=Banana
63
+target6.showInterface=false
64
+target6.type=ClassTarget
65
+target6.width=80
66
+target6.x=160
67
+target6.y=70