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

📄 pq8.html

📁 卡耐基课程练习
💻 HTML
字号:
<span class="dialogueheader">Take Assessment: Practical Quiz 8</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="657660" 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:47:11 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:47:11 GMT+0800.</td>  <td width="5"><br></td></tr></tbody></table>

<a name="top_14432"></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="#14432">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">VHS and DVD Movies</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 abstract classes 
          <ul>
            <li> How to define an abstract class</li>

          </ul>
        </li>
        <li>Knowledge of interfaces 
          <ul>
            <li> How to define an interface</li>
            <li>How to define a class that implements an interface</li>
          </ul>
        </li>

      </ul>
  </li></ul>
  <p> <b><i>Goals:</i></b> Reinforce your ability to use Java interfaces and abstract 
    classes
  </p><p> <b><i>Outcomes:</i></b> You will demonstrate mastery of the following: 
  </p><ul>
    <li>Writing interfaces</li>

    <li>Writing classes that implement interfaces</li>
    <li>Writing abstract classes</li>
  </ul>
</blockquote>
<h3>Background </h3>

<p>In this assignment, you will create the following classes and interfaces:</p>
<ul>
  <li>Abstract class 
    <ul>

      <li><code>Movie</code></li>
    </ul>
  </li>
  <li>Interfaces 
    <ul>
      <li> <code>VHS</code></li>
      <li> <code>DVD</code></li>

    </ul>
  </li>
  <li>Classes 
    <ul>
      <li> <code>VHSMovie</code></li>
      <li> <code>DVDMovie</code></li>
    </ul>

  </li>
</ul>
<h3>Description</h3>
<p>The following class diagram illustrates the relationships between the interfaces 
  and classes:</p>
<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-adv-clss-dsgn/assm-qz-pr-intrfcs/pool-pr-intrfcs/qn-pr-movie/handout/images/uml-movie.jpg" alt="Figure 1 Class diagram" height="423" width="564"></td>
  </tr>
  <tr> 
    <td><strong>Figure 1 </strong><em> Class diagram</em></td>

  </tr>
</tbody></table>
<p>The specifications of the interfaces and classes are as follows:</p>
<h4>Abstract class <code>Movie</code></h4>
<p>The abstract class <code>Movie</code> stores the information of a movie.</p>
<p><em>Instance variables:</em></p>
<ul>
  <li><em><code>String title</code></em>. The title of the movie</li>

  <li><code><em>String[] actors</em></code>. The names of the actors in the movie</li>
  <li><code><em>String director</em></code>. The director of the movie</li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>
  <li> 
    <pre> <em>Movie(String initialTitle,
       String[] initialActors,
       String initialDirector)</em></pre>

    <p>Creates a <code>Movie</code> object and initializes the instance variables.</p>
  </li>
</ul>
<ul>
  <li><code><em>String getTitle()</em></code>. Returns the value of the variable 
    <code>title</code>.</li>
</ul>

<ul>
  <li><code><em>String[] getActors()</em></code>. Returns a reference to the array 
    <code>actors</code>. </li>
</ul>
<ul>
  <li><code><em>String getDirector()</em></code>. Returns the value of the variable 
    <code>director</code>.</li>
</ul>
<ul>

  <li><code><em>String toString()</em></code>. Returns the value of the variable 
    <code>title</code>.</li>
</ul>
<h4>Interface <code>VHS</code></h4>
<p>The interface <code>VHS</code> declares the methods for obtaining VHS tape 
  information.</p>
<p><em>Methods:</em></p>

<ul>
  <li> <code><em>String getFormat()</em></code>. Returns the format of the VHS 
    tape.</li>
</ul>
<ul>
  <li> <em><code>String getLanguage()</code></em>. Returns the language of the 
    VHS tape.</li>
</ul>
<h4>Interface <code>DVD</code></h4>

<p>The interface <code>DVD</code> declares the methods for obtaining DVD information.</p>
<p><em>Methods:</em></p>
<ul>
  <li> <code><em>int getRegionCode()</em></code>. Returns the region code of the 
    DVD.</li>
</ul>
<ul>
  <li> <code><em>String[] getAudioTracks()</em></code>. Returns an array with 
    the names of the audio tracks on the DVD.</li>

</ul>
<ul>
  <li> <code><em>String[] getSubtitles()</em></code>. Returns an array with the 
    languages of the subtitles on the DVD.</li>
</ul>
<h4>Class <code>VHSMovie</code></h4>
<p>The class <code>VHSMovie</code> extends class <code>Movie</code> and implements 
  the interface <code>VHS</code>. </p>

<p><em>Instance variables:</em></p>
<ul>
  <li><code><em>String format</em></code>. The format of the VHS movie</li>
  <li><code><em>String language</em></code>. The language of the VHS movie</li>
</ul>
<p><em>Constructor and methods:</em></p>
<ul>
  <li> 
    <pre><em>VHSMovie(String initialTitle,
         String[] initialActors,
         String initialDirector, 
         String initialFormat,
         String initialLanguage)</em></pre>

    <p>Creates a <code>VHSMovie</code> object and initializes the instance variables.</p>
  </li>
  <li> <em><code>String getFormat()</code></em>. Returns the value of the variable 
    <code>format</code>.</li>
</ul>
<ul>

  <li> <code><em>String getLanguage()</em></code>. Returns the value of the variable 
    <code>language</code>.</li>
</ul>
<ul>
  <li> <code><em>String toString()</em></code>. Returns a string representation 
    of the object with the following format: 
    <pre><em>title</em>,<em>format</em>,<em>language</em></pre>

    <p>where:</p>
    <ul>
      <li><code><em>title</em></code> is the title of the VHS movie.</li>
      <li><code><em>format</em></code> is the format of the VHS movie.</li>
      <li><code><em>language</em></code> is the language of the VHS movie.</li>

    </ul>
    <p>The fields are delimited by a comma ( , ). You can assume that the fields 
      themselves do not contain any commas.</p>
  </li>
</ul>
<h4>Class <code>DVDMovie</code></h4>
<p>The class <code>DVDMovie</code> extends class <code>Movie</code> and implements 
  the interface <code>DVD</code>.</p>

<p><em>Instance variables:</em></p>
<ul>
  <li><code><em>int regionCode</em></code>. The region code of the DVD movie</li>
  <li><code><em>String[] audioTracks</em></code>. The names of the audio tracks 
    on the DVD movie</li>
  <li><code><em>String[] subtitles</em></code>. The languages of the subtitles 
    on the DVD movie</li>
</ul>
<p><em>Constructor and methods:</em></p>

<ul>
  <li> 
    <pre><em>DVDMovie(String initialTitle,
         String[] initialActors,
         String initialDirector, 
         int initialRegionCode,
         String[] initialAudioTracks,
         String[] initialSubtitles)</em></pre>
    Creates a <code>DVDMovie</code> object and initializes the instance variables.</li>
</ul>
<ul>
  <li> <code><em>int getRegionCode()</em></code>. Returns the value of the variable 
    <code>regionCode</code>.</li>

</ul>
<ul>
  <li> <code><em>String[] getAudioTracks()</em></code>. Returns a reference to 
    the array <code>audioTracks</code>.</li>
</ul>
<ul>
  <li> <code><em>String[] getSubtitles()</em></code>. Returns a reference to the 
    array <code>subtitles</code>.</li>

</ul>
<ul>
  <li> <code><em>String toString()</em></code>. Returns a string representation 
    of the object with the following format: 
    <pre><em>title</em>,<em>regionCode</em><em></em></pre>
    <p>where:</p>
    <ul>
      <li><code><em>title</em></code> is the title of the DVD movie.</li>

      <li><code><em>regionCode</em></code> is the region code of the DVD movie.</li>
    </ul>
    <p>The fields are delimited by a comma ( , ). You can assume that the fields 
      themselves do not contain any commas.</p>
  </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>TestMovie</code> </li>
  <li>Class <code>TestVHS</code> </li>
  <li>Class <code>TestDVD</code> </li>
  <li>Class <code>TestVHSMovie</code> </li>

  <li>Class <code>TestDVDMovie</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-adv-clss-dsgn/assm-qz-pr-intrfcs/pool-pr-intrfcs/qn-pr-movie/handout/student-files.zip"><code>student-files.zip</code></a></cite> 
    — Download this file. This archive contains the following test drivers: 
    <ul>
      <li><cite><code>TestMovie.java</code></cite> </li>

    </ul>
    <ul>
      <li><cite><code>TestVHS.java</code></cite> </li>
      <li><cite><code>TestDVD.java</code></cite> </li>
      <li><cite><code>TestVHSMovie.java</code></cite> </li>
      <li><cite><code>TestVHSMovie.java</code></cite> </li>

    </ul>
  </li>
</ul>
<h3>Tasks </h3>
<p>Implement the abstract class <code>Movie</code>, the interfaces <code>VHS</code> 
  and <code>DVD</code>, and the concrete classes <code>VHSMovie</code> and <code>DVDMovie</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:\&gt;</tt><kbd>unzip student-files.zip</kbd> </p>
  </li>
</ol>
<ol start="2">
  <li><strong>Then</strong>, implement the class <code>Movie</code> from scratch. 
    Use <code>TestMovie</code> to test your implementation. </li>

</ol>
<ol start="3">
  <li><strong>Next</strong>, implement the interface <code>VHS</code> from scratch. 
    Use <code>TestVHS</code> to test your implementation. </li>
</ol>
<ol start="4">
  <li><strong>Then</strong>, implement the interface <code>DVD</code> from scratch. 
    Use <code>TestDVD</code> to test your implementation. </li>

</ol>
<ol start="5">
  <li><strong>Next</strong>, implement the class <code>VHSMovie</code> from scratch. 
    Use <code>TestVHSMovie</code> to test your implementation. </li>
</ol>
<ol start="6">
  <li><strong>Finally</strong>, implement the class <code>DVDMovie</code> from 
    scratch. Use <code>TestDVDMovie</code> to test your implementation. </li>

</ol>
<h3>Submission</h3>
<p>Upon completion, submit <strong>only</strong> the following:</p>
<ol>
  <li><code>Movie.java</code> </li>
  <li><code>VHS.java</code> </li>

  <li><code>DVD.java</code> </li>
  <li><code>VHSMovie.java</code> </li>
  <li><code>DVDMovie.java</code> </li>
</ol>
 </td>
<td width="5"><br></td></tr></tbody></table>
<a name="14432"></a><table><tbody><tr>

<td width="5"><br></td>  <td class="td0_x" align="left" valign="top"> <a href="#top_14432">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_14432">File to submit:</label><br> <input class="x" name="file_to_add_14432" 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=14432", 14432, false)' type="submit"></td><td width="5"><br></td></tr></tbody></table>
<hr><input name="pr_state_14432" id="pr_state_14432" 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:47:11 UTC" id="end_date" name="end_date" type="hidden">  <input value="421063" id="course_section_id" name="course_section_id" type="hidden">  <input value="14429" id="assm_id" name="assm_id" type="hidden">  <input value="657660" id="template_id" name="template_id" type="hidden">  <input value="657661" 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 + -