⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exe4.html

📁 卡耐基课程练习
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</ul>
<ul>
  <li> <code><em>public void displayCatalog</em></code> — Displays  the catalog. This method is complete and  should not be modified.</li>
</ul>
<ul>
  <li> <code><em>public void displayProductInfo()</em></code> — Prompts the user for a product code and displays  information about the specified product. This method is complete and  should not be modified.</li>
</ul>

<ul>
  <li> <code><em>public void displayOrder()</em></code> — Displays the products in the current order. This method is complete and  should not be modified.</li>
</ul>
<ul>
  <li> <code><em>public void addModifyProduct()</em></code> —  Prompts the user for a product code and  quantity. If the specified product is not already    	 part of the order, it is added; otherwise, the quantity of the    	  product is updated. This method is complete and  should not be modified.</li>
</ul>
<ul>

  <li> <code><em>public void removeProduct()</em></code> — Prompts the user for a product code and removes the specified product from the current order. This method is complete and  should not be modified.</li>
</ul>
<ul>
  <li> <code><em>public void saleOrder()</em></code> — Registers the sale of the current order. This method is complete and  should not be modified.</li>
</ul>
<ul>
  <li> <code><em>public void displayOrdersSold()</em></code> —  Displays the orders that have been sold. This method is complete and  should not be modified.</li>

</ul>
<ul>
  <li> <code><em>public void displayNumberOfOrders(Product product)</em></code> — Displays the number of orders that contain the specified product.  This method is incomplete and should be implemented.</li>
</ul>
<ul>
  <li> <code><em>public void displayTotalQuantityOfProducts()</em></code> — Displays the total quantity sold for  each product in the catalog. This method is incomplete and should be implemented.</li>
</ul>

<h4>Test driver classes</h4>
<p>Complete implementations of the following test drivers are provided in the
  student archive:</p>
<ul>
  <li>Class <code>TestCatalog</code> </li>
  <li>Class <code>TestOrder</code> </li>
  <li>Class <code>TestSales</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-collctns/assm-exer-impl-collctns/pool-pr-impl-collctns/qn-pr-collctns-cof-gou-sys/handout/student-files.zip"><code>student-files.zip</code></a></cite> 
    — Download this file. This archive contains the following: 
    <ul>
      <li>Class files 
        <ul>
          <li><cite><code>Coffee.class</code> </cite></li>

          <li><cite><code>CoffeeBrewer.class</code> </cite></li>
          <li><cite><code>Product.class</code> </cite></li>
          <li><cite><code>OrderItem.class</code> </cite></li>
        </ul>
      </li>
      <li>Documentation 
        <ul>

          <li><cite><code>Coffee.html</code></cite> </li>
          <li><cite><code>CoffeeBrewer.html</code></cite> </li>
          <li><cite><code>Product.html</code></cite></li>
          <li><cite><code>OrderItem.html</code></cite> </li>
        </ul>

      </li>
      <li>Java files 
        <ul>
          <li><cite><code>GourmetCoffee.java</code></cite> — An incomplete implementation.</li>
          <li><cite><code>TestCatalog.java</code></cite> — A complete implementation.</li>
          <li><cite><code>TestOrder.java</code></cite> — A complete implementation.</li>

          <li><cite><code>TestSales.java</code></cite> — A complete implementation.</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>
<h3>Tasks </h3>
<p>Implement classes <code>Catalog</code>, <code>Order</code>, and <code>Sales</code>. 
  Document your code 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:\&gt;</tt><kbd>unzip student-files.zip</kbd> </p>
  </li>
  <li><strong>Then</strong>, implement class <code>Catalog</code> from scratch.<strong> 
    </strong>Use <code>TestCatalog</code> to test your implementation.</li>

</ol>
<ol start="3">
  <li><strong>Next</strong>, implement class <code>Order</code> from scratch.<strong> 
    </strong>Use <code>TestOrder</code> to test your implementation.</li>
</ol>
<ol start="5">
  <li><strong>Then</strong>, implement class <code>Sales</code> from scratch.
     Use <code>TestSales</code> to test your implementation.</li>

</ol>
<ol start="6">
  <li><b>Finally</b>, complete class <code>GourmetCoffee</code>.  
    It uses a <code>Catalog</code> object created by method <code>GourmetCoffee.loadCatalog</code> and a <code>Sales</code> object generated by method <code>GourmetCoffee.loadSales</code>. 
    To complete class <code>GourmetCoffee</code>, implement the following methods:</li>

</ol>
<blockquote>
  <ul>
    <li><code><em>public void displayNumberOfOrders(Product product)</em></code> — This method displays the number of orders in the <code>sales</code> object that contain the specified product. Compile and execute the class <code>GourmetCoffee</code>. Verify that the method <code><em>displayNumberOfOrders</em></code> works correctly. The following is the output that should be displayed for the  product with product code <code>A001</code> and the orders preloaded by the method <code>loadSales</code>:

<blockquote>
        <p><code>[0] Quit<br>
          [1] Display catalog<br>
          [2] Display product<br>
          [3] Display current order<br>
          [4] Add|modify product to|in current order<br>
          [5] Remove product from current order<br>

          [6] Register sale of current order<br>
          [7] Display sales<br>
          [8] Display number of orders with a specific product<br>
          [9] Display the total quantity sold for each product<br>
          choice&gt; <strong>8</strong></code></p>

        <p><code>Product code&gt; <strong>A001</strong><br>
          Number of orders that contains the product A001: 4</code></p>
      </blockquote>
    </li>
  </ul>
</blockquote>
<blockquote> 
  <ul>

    
    <li><code><em>public void displayTotalQuantityOfProducts()</em></code> — This method  displays  the total quantity  sold for each product in the catalog.
The information 
      of each product must be displayed on a single line in the following format:
      <p><var>ProductCode</var> <var>Quantity</var><var></var></p>
      <p>The following is a description of the information included in the format 
        above:</p>
    </li>
  </ul>
  <blockquote> 
    <ul>

      <li><var>ProductCode</var> — the code of the product</li>
      <li><var>Quantity</var> — the total quantity of product that has been sold in the store</li>
    </ul>
  </blockquote>
  <ul>
    <p>Compile and execute the class <code>GourmetCoffee</code>. Verify that the method <code>displayTotalQuantityOfProducts</code> works correctly. The following is the output that should be displayed for the orders preloaded by the method <code>loadSales</code>:</p>

    <blockquote>
      <p><code>[0] Quit<br>
        [1] Display catalog<br>
        [2] Display product<br>
        [3] Display current order<br>
        [4] Add|modify product to|in current order<br>

        [5] Remove product from current order<br>
        [6] Register sale of current order<br>
        [7] Display sales<br>
        [8] Display number of orders with a specific product<br>
        [9] Display the total quantity sold for each product<br>
        choice&gt; <strong>9</strong></code></p>

      <p><code>C001 9<br>
        C002 4<br>
        C003 5<br>
        C004 0<br>
        C005 8<br>
        B001 2<br>

        B002 1<br>
        B003 2<br>
        A001 12<br>
        A002 6<br>
        A003 5<br>
        A004 6<br>

        A005 0</code></p>
    </blockquote>
  </ul>
</blockquote>
<h3>Submission</h3>
<p>Upon completion, submit <strong>only</strong> the following.</p>
<ol>
  <li><code>Catalog.java</code></li>

  <li><code>Order.java</code></li>
  <li><code>Sales.java</code></li>
  <li><code>GourmetCoffee.java</code></li>
</ol>
 </td>
<td width="5"><br></td></tr></tbody></table>
<a name="14421"></a><table><tbody><tr>
<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"> <a href="#top_14421">Go to top of question.</a> </td>

<td width="5"><br></td></tr></tbody></table>
<hr><table><tbody><tr>
<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"><label class="lbl0-x" for="file_to_add_14421">File to submit:</label><br> <input class="x" name="file_to_add_14421" value="" size="20" maxlength="500" type="file"> </td>
<td width="5"><br></td><td valign="bottom">  <input class="x" value="Upload File" name="add_file" id="add_file" style="width: 12em;" onclick='return SetUploadTime("https://seqcc.icarnegie.com:443/takeassmcmd.php?question_id=14421", 14421, false)' type="submit"></td><td width="5"><br></td></tr></tbody></table>
<hr><input name="pr_state_14421" id="pr_state_14421" value="a:2:{i:0;s:10:&quot;incomplete&quot;;i:1;a:0:{}}" type="hidden"><table><tbody><tr>
  </tr></tbody></table>
<input name="max_mins_per_try" id="max_mins_per_try" value="120" type="hidden">  <input value="2008-11-29 10:54:58 UTC" id="end_date" name="end_date" type="hidden">  <input value="421063" id="course_section_id" name="course_section_id" type="hidden">  <input value="14418" id="assm_id" name="assm_id" type="hidden">  <input value="657801" id="template_id" name="template_id" type="hidden">  <input value="657802" id="record_id" name="record_id" type="hidden">  <input value="" id="client_time" name="client_time" type="hidden"><table><tbody><tr>

<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"> <a href="#top_of_page">Go to top of assessment.</a> </td>
  </tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td>  <td class="td0_copyright" align="left" valign="top"> ? Copyright 2006 iCarnegie, Inc.  All rights reserved. </td>
</tr></tbody></table>
</form>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -