📄 takeassmcmd.html
字号:
String initialFlavor,
String initialAroma,
String initialAcidity,
String initialBody)</em></pre>
<p>Constructor that initializes the instance
variables <code>code</code>, <code>description</code>, <code>price</code>, <code>origin</code>,
<code>roast</code>, <code>flavor</code>, <code>aroma</code>, <code>acidity</code>,
and <code>body</code>.</p>
</li>
</ul>
<ul>
<li> <code><em>public String getOrigin()</em></code>. Returns the value of instance
variable <code>origin</code>.</li>
</ul>
<ul>
<li> <code><em>public String getRoast()</em></code>. Returns the value of instance
variable <code>roast</code>.</li>
</ul>
<ul>
<li> <code><em>public String getFlavor()</em></code>. Returns the value of instance
variable <code>flavor</code>.</li>
</ul>
<ul>
<li> <code><em>public String getAroma()</em></code>. Returns the value of instance
variable <code>aroma</code>.</li>
</ul>
<ul>
<li> <code><em>public String getAcidity()</em></code>. Returns the value of
instance variable <code>acidity</code>.</li>
</ul>
<ul>
<li> <code><em>public String getBody()</em></code>. Returns the value of instance
variable <code>body</code>.</li>
</ul>
<ul>
<li><code><em>String toString()</em></code>. Overrides the method <code>toString</code>
in the class <code>Object</code>. Returns the string representation of a <code>Coffee</code>
object. The <code>String</code> returned has the following format:
<blockquote>
<pre><em>code</em>_<em>description</em>_<em>price</em>_<em>origin</em>_<em>roast</em>_<em>flavor</em>_<em>aroma</em>_<em>acidity</em>_<em>body</em></pre>
</blockquote>
<p>The fields are separated by an underscore ( <code>_</code> ). You can assume
that the fields themselves do not contain any underscores.</p>
</li>
</ul>
<h4>Class <code>CoffeeBrewer</code></h4>
<p>Class <code>CoffeeBrewer</code> models a coffee
brewer. It extends class <code>Product</code>.</p>
<p><em>Instance variables:</em></p>
<ul>
<li><code><em>model</em></code>. The model of the coffee brewer<code></code></li>
<li><code><em>waterSupply</em></code>. The water supply (<code><em>Pour-over</em></code>
or <code><em>Automatic</em></code>)</li>
<li><code><em>numberOfCups</em></code>. The capacity of the coffee brewer<code></code></li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>
<li> <pre>public CoffeeBrewer(String initialCode,
String initialDescription,
double initialPrice,
String initialModel,
String initialWaterSupply,
int initialNumberOfCups)</pre>
<p>Constructor that initializes the instance variables <code>code</code>, <code>description</code>,
<code>price</code>, <code>model</code>, <code>waterSupply</code>, and <code>numberOfCups</code>.</p>
</li>
</ul>
<ul>
<li> <code><em>public String getModel()</em></code>. Returns the value of instance
variable <code>model</code>.</li>
</ul>
<ul>
<li> <code><em>public String getWaterSupply()</em></code>. Returns the value
of instance variable <code>waterSupply</code>.</li>
</ul>
<ul>
<li> <code><em>public int getNumberOfCups()</em></code>. Returns the value of
instance variable <code>numberOfCups</code>.</li>
</ul>
<ul>
<li><code><em>String toString()</em></code>. Overrides the method <code>toString</code>
in the class <code>Object</code>. Returns the string representation of a <code>CoffeeBrewer</code>
object. The <code>String</code> returned has the following format:
<blockquote>
<pre><em>code</em>_<em>description</em>_<em>price</em>_<em>model</em>_<em>waterSupply</em>_<em>numberOfCups</em></pre>
</blockquote>
<p>The fields are separated by an underscore ( <code>_</code> ). You can assume
that the fields themselves do not contain any underscores.</p>
</li>
</ul>
<h4>Class <code>OrderItem</code></h4>
<p>Class <code>OrderItem</code> models an item in an order. </p>
<p><em>Instance variables:</em></p>
<ul>
<li><code><em>product</em></code>. This instance variable represents the one-way
association between <code>OrderItem</code> and <code>Product</code>. It contains
a reference to a <code>Product</code> object.</li>
</ul>
<ul>
<li><code><em>quantity</em></code>. The quantity of the product in the order<code></code>.</li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>
<li>
<pre><em>public OrderItem(Product initialProduct,
int initialQuantity)</em></pre>
<p>Constructor that initializes the instance variables <code>product</code>
and <code>quantity</code>.</p>
</li>
</ul>
<ul>
<li> <code><em>public Product getProduct()</em></code>. Returns the value of
the instance variable <code>product</code>, a reference to a <code>Product</code>
object.</li>
</ul>
<ul>
<li> <code><em>public int getQuantity()</em></code>. Returns the value of the
instance variable <code>quantity</code>.</li>
</ul>
<ul>
<li> <code><em>public void setQuantity(int newQuantity)</em></code>. Sets the
instance variable <code>quantity</code> to the value of parameter <code>newQuantity</code>.</li>
</ul>
<ul>
<li> <code><em>public double getValue()</em></code>. Returns the product of
<code>quantity</code> and <code>price</code>.</li>
</ul>
<ul>
<li><code><em>String toString()</em></code>. Overrides the method <code>toString</code>
in the class <code>Object</code>. Returns the string representation of an
<code>OrderItem</code> object. The <code>String</code> representation has
the following format:
<blockquote>
<pre><em>quantity</em> <em>product-code</em> <em>product-price</em></pre>
</blockquote>
<p>The fields are separated by a space. You can assume that the fields themselves
do not contain any spaces.</p>
</li>
</ul>
<h4>Test driver classes</h4>
<p>Complete implementations of the following test drivers are provided in the
student archive. Use these test drivers to verify that your code works correctly.
</p>
<ul>
<li>Class <code>TestProduct</code></li>
<li>Class <code>TestCoffee</code> </li>
<li>Class <code>TestCoffeeBrewer</code> </li>
<li>Class <code>TestOrderItem</code></li>
</ul>
<h3>Files</h3>
The following files are needed to complete this assignment:
<ul>
<li><cite><a href="/content/SSD/SSD3/4.2.0.1/normal/pg-class-imp/pg-impl-class/assm-exer-impl-class/pool-pr-impl-class/qn-pr-impl-class-cof-gou-sys/handout/student-files.zip"><code>student-files.zip</code></a></cite>
— Download this file. This archive contains the following:
<ul>
<li><cite><code>TestProduct.java</code></cite> </li>
<li><cite><code>TestCoffee.java</code></cite> </li>
<li><cite><code>TestCoffeeBrewer.java</code></cite> </li>
<li><cite><code>TestOrderItem.java</code></cite> </li>
</ul>
</li>
</ul>
<h3>Tasks </h3>
<p>Implement classes <code>Product</code>, <code>Coffee</code>, <code>CoffeeBrewer</code>,
and <code>OrderItem</code>. Document using Javadoc and follow Sun's code conventions.
The following steps will guide you through this assignment. Work incrementally
and test each increment. Save often. </p>
<ol start="1">
<li><strong>Extract </strong> the files by issuing the following command at
the command prompt:
<p><tt>C:\></tt><kbd>unzip student-files.zip</kbd> </p>
</li>
<li><strong>Then</strong>, implement class <code>Product</code> from scratch.<strong>
</strong>Use <code>TestProduct</code> driver to test your implementation.</li>
</ol>
<ol start="3">
<li><strong>Next</strong>, implement class <code>Coffee</code> from scratch.<strong>
</strong>Use <code>TestCoffee</code> driver to test your implementation.</li>
</ol>
<ol start="4">
<li><strong>Then</strong>, implement class <code>CoffeeBrewer</code>
from scratch. Use <code>TestCoffeeBrewer</code> driver to test your
implementation.</li>
</ol>
<ol start="5">
<li><strong>Finally</strong>, implement class <code>OrderItem</code> from scratch.
Use <code>TestOrderItem</code> driver to test your implementation.</li>
</ol>
<h3>Submission</h3>
<p>Upon completion, submit <strong>only</strong> the following:</p>
<ol>
<li><code>Product.java</code> </li>
<li><code>Coffee.java</code></li>
<li><code>CoffeeBrewer.java</code> </li>
<li><code>OrderItem.java</code> </li>
</ol> </td>
<td width=5><br></td></tr></table>
<a name="9710101"></a><table><tr>
<td width=5><br></td> <td valign=top class=td0_x align=left > <a href="#top_9710101">Go to top of question.</a> </td>
<td width=5><br></td></tr></table>
<hr><table><tr>
<td width=5><br></td> <td valign=top class=td0_x align=left ><span class=lbl0-x>File to submit:</span><br> <input type=file class='x' name=file_to_add_9710101 value="" size=20 maxLength=500 > </td>
<td width=5><br></td><td valign=bottom> <input class=x value="Upload File" type=submit name=add_file id=add_file style="width: 12em;" onClick='return SetUploadTime("https://www.icarnegie.com:443/takeassmcmd.php?question_id=9710101", 9710101, false)'></td><td width=5><br></td><td valign=bottom> <input class=x value="Forward File" type=submit name=mail_file id=mail_file style="width: 12em;" onClick='return SetUploadTime("https://whu-cqc.icarnegie.com:443/mailuploadcmd.php?question_id=9710101", 9710101, true)'></td><td width=5><br></td><td valign=bottom> <input class=x value="Refresh" onClick="ChangeCommand(document.Assm, 'https://www.icarnegie.com:443/refreshassmtakecmd.php?question_id=9710101')" type=submit onfocus='ResetTarget()'></td><td width=5><br></td><td valign=bottom> <input class=x-font value="Ready for Grading" onClick="ChangeCommand(document.Assm, 'https://www.icarnegie.com:443/takeassmcmd.php?question_id=9710101')" type=submit name=ready_for_grading id=ready_for_grading style="width: 12em;" onfocus='ResetTarget()' disabled></td><td width=5><br></td></tr></table>
<hr><table><tr>
<input type=hidden name="pr_state_9710101" id="pr_state_9710101" value='a:2:{i:0;s:10:"incomplete";i:1;a:0:{}}' ></tr></table>
<table><tr>
<td width=5><br></td> <td valign=top class=td0_x align=left > <a href="#top_of_page">Go to top of assessment.</a> </td>
<input type=hidden name="assm_title" id="assm_title" value='Exercise 3' > <input type=hidden name="max_mins_per_try" id="max_mins_per_try" value='' > <input type=hidden name="end_date" id="end_date" value='' > <input type=hidden name="course_section_id" id="course_section_id" value='10692391' > <input type=hidden name="assm_id" id="assm_id" value='9710098' > <input type=hidden name="template_id" id="template_id" value='11144926' > <input type=hidden name="record_id" id="record_id" value='11144927' > <input type=hidden name="client_time" id="client_time" value='' ></tr></table>
<table><tr>
<td width=5><br></td> <td class=td0_copyright align=left valign=top >
<span class=copyright ><br>© Copyright 2006 iCarnegie, Inc. All rights reserved.</span></td>
</tr></table>
</form>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -