Skip to content

Commit 860af32

Browse files
committed
added changes
1 parent 0bf2120 commit 860af32

1 file changed

Lines changed: 13 additions & 24 deletions

File tree

‎source/ch3_javadatatypes.ptx‎

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,57 +1080,46 @@ public class HistoMap {
10801080
Improve <xref ref="java-word-count" text="type-global"/> to remove the punctuation.
10811081
</p>
10821082

1083-
<exercise label="java_map_parsons_example">
1083+
<exercise label="java_map_parsons_example">
10841084
<statement>
10851085
<p>
1086-
Rearrange and indent the blocks to create a Java method that accepts a dictionary (Map) of item prices and updates the price of a specific item.
1086+
Rearrange and indent the blocks to create a general Java method that accepts a dictionary (Map) of item prices and updates the price of a specific item. If the item does not exist, do nothing.
10871087
</p>
10881088
</statement>
10891089
<blocks>
10901090
<block order="1">
10911091
<choice correct="yes">
1092-
<code language="java">
1093-
public void updatePrice(Map&lt;String, Double&gt; catalog, String item, double newPrice) {
1094-
</code>
1092+
<cline>public void updatePrice(Map&lt;String, Double&gt; catalog, String item, double newPrice) {</cline>
10951093
</choice>
10961094
<choice correct="no">
1097-
<code language="java">
1098-
public void updatePrice(Map&lt;String, Double&gt; catalog, item, newPrice) {
1099-
</code>
1095+
<cline>public void updatePrice() {</cline>
1096+
<cline> Map&lt;String, Double&gt; catalog,</cline>
1097+
<cline> String item,</cline>
1098+
<cline> double newPrice</cline>
11001099
</choice>
11011100
</block>
11021101

11031102
<block order="2">
11041103
<choice correct="yes">
1105-
<code language="java">
1106-
if (catalog.containsKey(item)) {
1107-
</code>
1104+
<cline> if (catalog.containsKey(item)) {</cline>
11081105
</choice>
11091106
<choice correct="no">
1110-
<code language="java">
1111-
if (catalog.get(item) == null) {
1112-
</code>
1107+
<cline> if (catalog.get(item) == null) {</cline>
11131108
</choice>
11141109
</block>
11151110

11161111
<block order="3">
11171112
<choice correct="yes">
1118-
<code language="java">
1119-
catalog.put(item, newPrice);
1120-
</code>
1113+
<cline> catalog.put(item, newPrice);</cline>
11211114
</choice>
11221115
<choice correct="no">
1123-
<code language="java">
1124-
catalog.add(item, newPrice);
1125-
</code>
1116+
<cline> catalog.add(item, newPrice);</cline>
11261117
</choice>
11271118
</block>
11281119

11291120
<block order="4">
1130-
<code language="java">
1131-
}
1132-
}
1133-
</code>
1121+
<cline> }</cline>
1122+
<cline>}</cline>
11341123
</block>
11351124
</blocks>
11361125
</exercise>

0 commit comments

Comments
 (0)