Xcuello 5 vuotta sitten
vanhempi
commit
6a92132c29

+ 37
- 46
.idea/workspace.xml Näytä tiedosto

@@ -2,17 +2,7 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="268ab437-e0d5-4447-8401-9f321aad6d50" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
7
-      <change afterPath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java" afterDir="false" />
8
-      <change afterPath="$PROJECT_DIR$/src/test/java/InventoryTest.java" afterDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
10
-      <change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
11 5
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
12
-      <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
13
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/MainApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/MainApplication.java" afterDir="false" />
14
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java" afterDir="false" />
15
-      <change beforePath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java" afterDir="false" />
16 6
     </list>
17 7
     <ignored path="$PROJECT_DIR$/out/" />
18 8
     <ignored path="$PROJECT_DIR$/target/" />
@@ -26,13 +16,13 @@
26 16
     <session id="-1546935440">
27 17
       <usages-collector id="statistics.lifecycle.project">
28 18
         <counts>
29
-          <entry key="project.closed" value="32" />
19
+          <entry key="project.closed" value="35" />
30 20
           <entry key="project.open.time.0" value="2" />
31
-          <entry key="project.open.time.1" value="26" />
21
+          <entry key="project.open.time.1" value="29" />
32 22
           <entry key="project.open.time.11" value="1" />
33 23
           <entry key="project.open.time.2" value="2" />
34 24
           <entry key="project.open.time.7" value="1" />
35
-          <entry key="project.opened" value="32" />
25
+          <entry key="project.opened" value="35" />
36 26
         </counts>
37 27
       </usages-collector>
38 28
       <usages-collector id="statistics.file.extensions.edit">
@@ -63,14 +53,13 @@
63 53
   </component>
64 54
   <component name="FileEditorManager">
65 55
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
66
-      <file pinned="false" current-in-tab="true">
56
+      <file pinned="false" current-in-tab="false">
67 57
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/MainApplication.java">
68 58
           <provider selected="true" editor-type-id="text-editor">
69 59
             <state relative-caret-position="240">
70 60
               <caret line="16" column="57" selection-start-line="16" selection-start-column="57" selection-end-line="16" selection-end-column="57" />
71 61
               <folding>
72 62
                 <element signature="imports" expanded="true" />
73
-                <element signature="e#353#362#0" expanded="true" />
74 63
               </folding>
75 64
             </state>
76 65
           </provider>
@@ -79,8 +68,8 @@
79 68
       <file pinned="false" current-in-tab="false">
80 69
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java">
81 70
           <provider selected="true" editor-type-id="text-editor">
82
-            <state relative-caret-position="300">
83
-              <caret line="20" column="16" selection-start-line="20" selection-start-column="16" selection-end-line="20" selection-end-column="16" />
71
+            <state relative-caret-position="435">
72
+              <caret line="29" column="45" selection-start-line="29" selection-start-column="45" selection-end-line="29" selection-end-column="45" />
84 73
               <folding>
85 74
                 <element signature="imports" expanded="true" />
86 75
               </folding>
@@ -91,7 +80,7 @@
91 80
       <file pinned="false" current-in-tab="false">
92 81
         <entry file="file://$PROJECT_DIR$/src/test/java/InventoryTest.java">
93 82
           <provider selected="true" editor-type-id="text-editor">
94
-            <state relative-caret-position="352">
83
+            <state relative-caret-position="1590">
95 84
               <caret line="106" column="23" selection-start-line="106" selection-start-column="23" selection-end-line="106" selection-end-column="23" />
96 85
               <folding>
97 86
                 <element signature="imports" expanded="true" />
@@ -103,8 +92,8 @@
103 92
       <file pinned="false" current-in-tab="false">
104 93
         <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java">
105 94
           <provider selected="true" editor-type-id="text-editor">
106
-            <state relative-caret-position="525">
107
-              <caret line="35" column="60" lean-forward="true" selection-start-line="35" selection-start-column="38" selection-end-line="35" selection-end-column="60" />
95
+            <state relative-caret-position="510">
96
+              <caret line="35" column="60" selection-start-line="35" selection-start-column="38" selection-end-line="35" selection-end-column="60" />
108 97
               <folding>
109 98
                 <element signature="imports" expanded="true" />
110 99
               </folding>
@@ -112,11 +101,11 @@
112 101
           </provider>
113 102
         </entry>
114 103
       </file>
115
-      <file pinned="false" current-in-tab="false">
104
+      <file pinned="false" current-in-tab="true">
116 105
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java">
117 106
           <provider selected="true" editor-type-id="text-editor">
118
-            <state relative-caret-position="690">
119
-              <caret line="46" selection-start-line="46" selection-end-line="46" />
107
+            <state relative-caret-position="735">
108
+              <caret line="49" column="24" lean-forward="true" selection-start-line="49" selection-start-column="24" selection-end-line="49" selection-end-column="24" />
120 109
             </state>
121 110
           </provider>
122 111
         </entry>
@@ -171,6 +160,8 @@
171 160
       <foldersAlwaysOnTop value="true" />
172 161
     </navigator>
173 162
     <panes>
163
+      <pane id="Scope" />
164
+      <pane id="PackagesPane" />
174 165
       <pane id="ProjectPane">
175 166
         <subPane>
176 167
           <expand>
@@ -225,8 +216,6 @@
225 216
           <select />
226 217
         </subPane>
227 218
       </pane>
228
-      <pane id="Scope" />
229
-      <pane id="PackagesPane" />
230 219
     </panes>
231 220
   </component>
232 221
   <component name="PropertiesComponent">
@@ -437,6 +426,9 @@
437 426
       <workItem from="1541607428633" duration="15000" />
438 427
       <workItem from="1542134729434" duration="6716000" />
439 428
       <workItem from="1542222383214" duration="2467000" />
429
+      <workItem from="1542224862693" duration="441000" />
430
+      <workItem from="1543519272630" duration="71000" />
431
+      <workItem from="1543519357733" duration="38000" />
440 432
     </task>
441 433
     <servers />
442 434
   </component>
@@ -464,13 +456,13 @@
464 456
     </history-entry>
465 457
   </component>
466 458
   <component name="TimeTrackingManager">
467
-    <option name="totallyTimeSpent" value="15700000" />
459
+    <option name="totallyTimeSpent" value="16250000" />
468 460
   </component>
469 461
   <component name="ToolWindowManager">
470
-    <frame x="0" y="23" width="1280" height="701" extended-state="6" />
462
+    <frame x="0" y="23" width="1280" height="698" extended-state="6" />
471 463
     <editor active="true" />
472 464
     <layout>
473
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.39176092" />
465
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.411147" />
474 466
       <window_info id="Structure" order="1" weight="0.24959612" />
475 467
       <window_info id="Nl-Palette" order="2" />
476 468
       <window_info id="Favorites" order="3" side_tool="true" />
@@ -485,7 +477,7 @@
485 477
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
486 478
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
487 479
       <window_info anchor="bottom" id="TODO" order="6" />
488
-      <window_info anchor="bottom" id="Terminal" order="7" weight="0.328" />
480
+      <window_info anchor="bottom" id="Terminal" order="7" weight="0.32673267" />
489 481
       <window_info anchor="bottom" id="Event Log" order="8" side_tool="true" weight="0.3296" />
490 482
       <window_info anchor="bottom" id="Version Control" order="9" />
491 483
       <window_info anchor="bottom" id="Messages" order="10" weight="0.3284553" />
@@ -551,26 +543,29 @@
551 543
         </state>
552 544
       </provider>
553 545
     </entry>
554
-    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java">
546
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/MainApplication.java">
555 547
       <provider selected="true" editor-type-id="text-editor">
556
-        <state relative-caret-position="525">
557
-          <caret line="35" column="60" lean-forward="true" selection-start-line="35" selection-start-column="38" selection-end-line="35" selection-end-column="60" />
548
+        <state relative-caret-position="240">
549
+          <caret line="16" column="57" selection-start-line="16" selection-start-column="57" selection-end-line="16" selection-end-column="57" />
558 550
           <folding>
559 551
             <element signature="imports" expanded="true" />
560 552
           </folding>
561 553
         </state>
562 554
       </provider>
563 555
     </entry>
564
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java">
556
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java">
565 557
       <provider selected="true" editor-type-id="text-editor">
566
-        <state relative-caret-position="690">
567
-          <caret line="46" selection-start-line="46" selection-end-line="46" />
558
+        <state relative-caret-position="435">
559
+          <caret line="29" column="45" selection-start-line="29" selection-start-column="45" selection-end-line="29" selection-end-column="45" />
560
+          <folding>
561
+            <element signature="imports" expanded="true" />
562
+          </folding>
568 563
         </state>
569 564
       </provider>
570 565
     </entry>
571 566
     <entry file="file://$PROJECT_DIR$/src/test/java/InventoryTest.java">
572 567
       <provider selected="true" editor-type-id="text-editor">
573
-        <state relative-caret-position="352">
568
+        <state relative-caret-position="1590">
574 569
           <caret line="106" column="23" selection-start-line="106" selection-start-column="23" selection-end-line="106" selection-end-column="23" />
575 570
           <folding>
576 571
             <element signature="imports" expanded="true" />
@@ -578,24 +573,20 @@
578 573
         </state>
579 574
       </provider>
580 575
     </entry>
581
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Inventory.java">
576
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodewilmington/productmanager/ProductTest.java">
582 577
       <provider selected="true" editor-type-id="text-editor">
583
-        <state relative-caret-position="300">
584
-          <caret line="20" column="16" selection-start-line="20" selection-start-column="16" selection-end-line="20" selection-end-column="16" />
578
+        <state relative-caret-position="510">
579
+          <caret line="35" column="60" selection-start-line="35" selection-start-column="38" selection-end-line="35" selection-end-column="60" />
585 580
           <folding>
586 581
             <element signature="imports" expanded="true" />
587 582
           </folding>
588 583
         </state>
589 584
       </provider>
590 585
     </entry>
591
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/MainApplication.java">
586
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodewilmington/productmanager/Product.java">
592 587
       <provider selected="true" editor-type-id="text-editor">
593
-        <state relative-caret-position="240">
594
-          <caret line="16" column="57" selection-start-line="16" selection-start-column="57" selection-end-line="16" selection-end-column="57" />
595
-          <folding>
596
-            <element signature="imports" expanded="true" />
597
-            <element signature="e#353#362#0" expanded="true" />
598
-          </folding>
588
+        <state relative-caret-position="735">
589
+          <caret line="49" column="24" lean-forward="true" selection-start-line="49" selection-start-column="24" selection-end-line="49" selection-end-column="24" />
599 590
         </state>
600 591
       </provider>
601 592
     </entry>

+ 13
- 9
src/main/java/com/zipcodewilmington/productmanager/Inventory.java Näytä tiedosto

@@ -5,46 +5,50 @@ import java.util.List;
5 5
 
6 6
 public class Inventory {
7 7
 
8
-    List<Product> productList = new ArrayList<Product>();
8
+    private List<Product> productList = new ArrayList<Product>();
9 9
 
10 10
 
11 11
     public Inventory(List<Product> productList) {
12
-        
12
+
13
+        this.productList = productList;
14
+
13 15
     }
14 16
 
15 17
     public List<Product> getProductList() {
16 18
 
17
-        return productList;
19
+        return this.productList;
18 20
 
19 21
     }
20 22
 
21 23
     public void add(Product product) {
22 24
 
23
-        productList.add(product);
25
+        this.productList.add(product);
24 26
 
25 27
     }
26 28
 
27
-
28 29
     public boolean contains(Product product) {
29 30
 
30
-        return productList.contains(product);
31
+        return this.productList.contains(product);
31 32
     }
32 33
 
33 34
     public void remove(Product product) {
34 35
 
36
+        this.productList.remove(product);
37
+
35 38
     }
36 39
 
37 40
     public int size() {
38 41
 
39
-        return productList.size();
42
+        return this.productList.size();
40 43
     }
41 44
 
42 45
     public double getTotalValue() {
43 46
 
44 47
         double sum = 0;
45 48
 
46
-        for (Product p: productList) {
47
-             sum += p.getQuantity() * p.getPrice();
49
+        for (Product p : productList) {
50
+
51
+            sum += p.getQuantity() * p.getPrice();
48 52
         }
49 53
 
50 54
         return sum;

+ 0
- 6
src/main/java/com/zipcodewilmington/productmanager/Product.java Näytä tiedosto

@@ -6,21 +6,15 @@ package com.zipcodewilmington.productmanager;
6 6
 public class Product {
7 7
 
8 8
     private double price;
9
-
10 9
     private int id;
11
-
12 10
     private int quantity;
13
-
14 11
     private String name;
15 12
 
16 13
     public  Product(double price, int id, int quantity, String name ) {
17 14
 
18 15
         this.price = price;
19
-
20 16
         this.id = id;
21
-
22 17
         this.quantity = quantity;
23
-
24 18
         this.name = name;
25 19
 
26 20
     }