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

📄 exe3.html

📁 卡耐基课程练习
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<span class="dialogueheader">Take Assessment: Exercise 3</span><br><br>
  <form name="Assm" id="Assm" method="post" action="https://seqcc.icarnegie.com:443/submitassmcmd.php" enctype="multipart/form-data">

<a name="top_of_page"></a><input name="object_id" id="object_id" value="657769" type="hidden"><table><tbody><tr>
  </tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td>  <td class="td0_instructions" align="left" valign="top">
     <label class="instructions">Please answer the following question(s).<br>
If the assessment includes multiple-choice questions, click the "Submit Answers" button when you have completed those questions.</label></td>
</tr></tbody></table>
<input name="MAX_FILE_SIZE" id="MAX_FILE_SIZE" value="512000" type="hidden"><table><tbody><tr>
<td width="5"><br></td><script language="JavaScript">document.write('<td class=instructions>' + 'You have 120 minutes to take this assessment.' + '<br>' + 'Please complete this assessment by ' + ComputeLocalDate('2008-11-29 10:52:43 UTC') + '.' + '</td>');</script><td class="instructions">You have 120 minutes to take this assessment.<br>Please complete this assessment by Sat Nov 29 2008 18:52:43 GMT+0800.</td>  <td width="5"><br></td></tr></tbody></table>

<a name="top_14327"></a><table><tbody><tr>
<td width="5"><br></td>  <td class="td0_highlight-label" align="right" nowrap="nowrap" valign="top" width="12">
     <label class="highlight-label">1.</label></td>
<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"> <a href="#14327">Go to bottom of question.</a> </td>
</tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"> <!-- new pg 042903 ici -->
<h2 align="center">Implementing the Gourmet Coffee  System</h2>

<h3>Prerequisites, Goals, and Outcomes</h3>
<blockquote> <b><i>Prerequisites:</i></b> Before you begin this exercise, you 
  need mastery of the following:
<ul>
    <li> <em>Object Oriented Programming</em>
<ul>
        <li>Knowledge of class design
<ul>
            <li> Class attributes</li>

            <li>Constructors</li>
            <li>Accessor methods</li>
            <li>Mutator methods</li>
          </ul>
        </li>
        <li>Knowledge of inheritance
<ul>
            <li> How to implement a specialization/generalization relationship 
              using inheritance</li>

          </ul>
        </li>
      </ul>
  </li></ul>
  <p> <b><i>Goals:</i></b> Reinforce your 
    ability to implement Java classes using <em></em>inheritance. 
  </p><p> <b><i>Outcomes:</i></b> You
    will demonstrate mastery of the following: 
  </p><ul>

    <li>Implementing the constructors, accessors, and
    mutators of a Java class</li>
    <li>Using inheritance to implement a specialization/generalization relationship</li>
  </ul>
</blockquote>
<h3>Background </h3>

<p>This assignment asks you to implement some of the classes in the <em>Gourmet 
  Coffee System</em> specified on Exercise 2.</p>

<h3>Description</h3>
<p>In this assessment, you will implement the classes and  relationships 
  illustrated in the following class diagram:</p>

<blockquote>
<table border="0" cellpadding="2" cellspacing="2" width="75%">
  <tbody><tr>
      <td><img src="/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/images/impl-cof-gou-sys.jpg" alt="Figure 1 Portion of Gourmet Coffee System class diagram" height="444" width="467"></td>
  </tr>
  <tr>
      <td><b>Figure 1 </b><i> Portion of Gourmet Coffee System class
          diagram</i></td>

  </tr>
</tbody></table>
</blockquote>

<p>The class specifications are as follows:</p>
<h4>Class <code>Product</code></h4>
<p>The class <code>Product</code> models a generic product in the store.</p>
<p><em>Instance variables:</em></p>

<ul>
  <li><code><em>code</em></code>. The unique code that identifies the product</li>
  <li><code><em>description</em></code>. A short description of the product</li>
  <li><code><em>price</em></code>. The price of the product</li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>

  <li> 
    <pre><em>public Product(String initialCode,
               String initialDescription,
               double initialPrice)</em></pre>
	<p>Constructor that initializes the instance variables 
    <code>code</code>, <code>description</code>, and <code>price</code>.</p>
  </li>
</ul>
<ul>

  <li> <code><em>public String getCode()</em></code>. Returns the value of instance 
    variable <code>code</code>.</li>
</ul>
<ul>
  <li> <code><em>public String getDescription()</em></code>. Returns the value 
    of instance variable <code>description</code>.</li>
</ul>

<ul>
  <li> <code><em>public double getPrice()</em></code>. Returns the value of instance 
    variable <code>price</code>.</li>
</ul>
<ul>
  <li><code><em>boolean equals(Object object)</em></code>. Overrides the method 
    <code>equals</code> in the class <code>Object</code>. Two <code>Product</code> 
    objects are equal if their codes are equal.</li>

</ul>
<ul>
  <li><code></code><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>Product</code> object. The <code>String</code> returned 
    has the following format: 
    <blockquote> 
      <pre><em>code</em><em>_description_price</em><em></em><em></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>Coffee</code></h4>
<p>The class <code>Coffee</code> models a coffee product. It  extends
  class <code>Product</code>.</p>

<p><em>Instance variables:</em></p>
<ul>
  <li><code><em>origin</em></code>. The origin of the coffee<code></code></li>
  <li><code><em>roast</em></code>. The roast of the coffee<code></code></li>
  <li><code><em>flavor</em></code>. The flavor of the coffee<code></code></li>
  <li><em><code>aroma</code></em>. The aroma of the coffee<code></code></li>

  <li><code><em>acidity</em></code>. The acidity of the coffee<code></code></li>
  <li><code><em>body</em></code>. The body of the coffee<code></code></li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>
  <li> 
    <pre><em>public Coffee(String initialCode,
              String initialDescription,
              double initialPrice,
              String initialOrigin,
              String initialRoast,
              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>

⌨️ 快捷键说明

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