Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"> <tbody> <tr> <td valign

ID: 3645403 • Letter: #

Question

<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="bottom" background="/ec/Courses/13775/CRS-DVUO-2148869/ConnectLab/tabgold_02_middle.gif"><strong><span color="#999999" size="2">i L A B&nbsp; O V E R V I E W </span></strong></td>
<td><img height="22" alt="" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/ConnectLab/tabgold_03_right.gif" width="8" border="0" name="tabgold_03_right" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="gold"><span color="#000080" size="2"><strong>Scenario and Summary</strong></span></td>
<td bgcolor="gold"></td>
</tr>
</tbody>
</table>
<p><span size="2"><br />This week, you will be implementing inheritance by creating a generic Racer base class along with two derived classes called StreetTuner and HotRod. You will make the Racer class abstract and include the abstract method IsDead() in the Racer class.<br /><br /></span></p>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr>
<td bgcolor="gold"><span color="#000080" size="2"><strong>Deliverables</strong></span></td>
</tr>
</tbody>
</table>
<p><span size="2"><br />Due this week:</span><span size="2">
<ul>
<li>Capture the console output window and paste it into a Word Document;</li>
</ul>
<font size="2">
<ul>
<li>Zip the project folder; and&nbsp;</li>
</ul>
</font></span></p>
<ul type="disc">
<li><span size="2">Put the zip file and screenshots (Word document) in the Dropbox. </span></li>
</ul>
<table cellspacing="0" cellpadding="0" border="0"><!-- fwtable fwsrc="labtab_blue.png" fwbase="labtab_blue.gif" fwstyle="Dreamweaver" fwdocid = "743967223" fwnested="0" -->
<tbody>
<tr>
<td><img height="22" alt="" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/ConnectLab/tabblue_01_left.gif" width="7" border="0" name="tabblue_01_left" /></td>
<td valign="bottom" background="/ec/Courses/13775/CRS-DVUO-2148869/ConnectLab/tabblue_02_middle.gif"><strong><span color="#999999" size="2">i L A B&nbsp; S T E P S </span></strong></td>
<td><img height="22" alt="" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/ConnectLab/tabblue_03_right.gif" width="8" border="0" name="tabblue_03_right" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP 1: Understand the UML Diagram</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="4"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<p align="center"><span size="2"><img alt="" src="http://www.chegg.com/CurrentCourse/Graphics/w7_ilab_img1.gif" /><br /><a class="dlink" href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#descbox1" rel="descbox1" role="button" jquery1339640189484="5" aria-controls="descbox1">Image Description</a></span></p>
<div class="descbox" id="descbox1" tabindex="-1" role="region" aria-expanded="false">
<p>The UML diagram four classes defined (1) Racer, (2) Engine, (3) Hot Rod, and (4) StreetTuner classes.<br /><br />The Racer class is the base parent abstract class of the Hot Rod and Street Tuner classes, which is represented by a directed line from the Hot Rod and Street Tuner classes to the Racer class and the end of the line touching the Racer class is a broad, unfilled arrow head. The racer class contains a engine object, which is represented by a directed line from the engine class to the Racer class, with a filled diamond touching the racer class, this line is labeled as a 1 to 1 relationship meaning that each racer object will contain one engine object and each engine is related to a single racer object.<br /><br />The class's attributes and methods are defined in separate class diagrams, and each class diagram is represented by a rectangular box subdivided into three vertically separated rectangular sub-sections. The top section contains the class name, the middle section contains the class attributes, and the bottom section contains the class methods.<br /><br />The classes are defined as follows:</p>
<p>Racer abstract<br /><span>Attributes</span><br /><span>private name string</span><br /><span>private speed integer</span><br /><span>private engine Engine</span><br /><span>Methods</span><br /><span>public Racer default constructor no parameters</span><br /><span>public Racer overloaded constructor parameters name string, speed integer, engine Engine</span><br /><span>public abstract IsDead Boolean</span><br /><span>public overrides ToString</span><br /><span>end class</span></p>
<p>Engine<br /><span>Attributes</span><br /><span>private cylinders integer</span><br /><span>private horsepower integer</span><br /><span>Methods</span><br /><span>public Engine default constructor no parameters</span><br /><span>public overrides ToString returns string</span><br /><span>end class</span></p>
<p>Hot Rod<br /><span>Attributes</span><br /><span>private blower boolean</span><br /><span>Methods</span><br /><span>public HotRod default constructor no parameters</span><br /><span>public HotRod overloaded constructor parameters name string, speed integer, engine Engine, blower Boolean</span><br /><span>public overrides IsDead boolean</span><br /><span>end class</span></p>
<p>Street Tuner<br /><span>Attributes</span><br /><span>private nitrous boolean</span><br /><span>Methods</span><br /><span>public StreetTuner default constructor no parameters</span><br /><span>public StreetTuner overloaded constructor parameters name string, speed integer, engine Engine, nitrous Boolean</span><br /><span>public overrides IsDean boolean</span><br /><span>public overrides ToString returns string</span><br /><span>end class</span></p>
<p class="instructions">Press the ESC key to close the image description and return to lecture.</p>
</div>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP 2: Build the Inheritance Hierarchy</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="6"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<p><span size="2"><font size="2">
<ul>
<li>Create a project called "CIS247_WK7_Lab_LASTNAME".</li>
</ul>
</font></span></p>
<ol type="1">
<li><span size="2">Build the class structure shown in the UML diagram. Remember to include properties for each class attribute. </span></li>
</ol>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP 3: Implement the Logic for the HotRod Class</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="7"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<p><span size="2"><font size="2">
<ul>
<li>Provide suitable logic for the ToString method. As always, the ToString method should reveal the state of an object.</li>
</ul>
</font></span></p>
<ol>
<li><span size="2">For the IsDead() method in HotRod, use the logic to implement the base class abstract IsDead method. </span></li>
</ol>
<p><span size="2">Hint: To generate a random number, use the following code, which returns a random number from 0 to 1:</span></p>
<p><span size="2" face="Courier New"><span color="#ff66cc">Random</span> rnd = <span color="#3366ff">new</span> <span color="#ff66cc">Random</span>();</span></p>
<p><span size="2" face="Courier New">rnd.NextDouble();</span></p>
<blockquote>
<p><img alt="" src="http://www.chegg.com/CurrentCourse/Graphics/CIS247A_W7_Lab_02.jpg" /></p>
</blockquote>
<div class="hidden">Pseudocode for the IsDead method of HotRod<br />Random rnd = new Random();<br />boolean dead<br /><br />if (speed &gt; 50 &amp;&amp; rnd.NextDouble() &gt; 0.6) <br />if (engineHorsePower &lt; 300 &amp;&amp; blower=true)<br />dead = false<br />else <br />dead = true <br />end if <br />else if (speed &gt; 100 &amp;&amp; rnd.NextDouble() &gt; 0.4) <br />if (engineHorsePower &gt;= 300 &amp;&amp; blower = true)<br />dead = true<br />else <br />dead = false <br />end if <br />else<br />dead = false <br />end if</div>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP 4: Implement the logic for the StreetTurner class</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="8"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<blockquote><span size="2"><font size="2">
<ul>
<li>Provide suitable logic for the ToString method. As always, the ToString method should reveal the state of an object.</li>
</ul>
</font></span><ol>
<li><span size="2">For the IsDead method in StreetTurner, use the logic below to implement the inherited abstract base class method called IsDead. </span></li>
</ol>
<p><img alt="" src="http://www.chegg.com/CurrentCourse/Graphics/CIS247A_W7_Lab_03.jpg" /></p>
</blockquote>
<div class="hidden">Pseudocode for the IsDead method of StreetTuner<br />Random rnd = new Random();<br />boolean dead<br />if (speed &gt; 50 &amp;&amp; rnd.NextDouble() &gt; 0.6) <br />if (engineHorsePower &lt; 300 &amp;&amp; nitrous=true)<br />dead = false<br />else <br />dead = true <br />end if <br />else if (speed &gt; 100 &amp;&amp; rnd.NextDouble() &gt; 0.4) <br />if (engineHorsePower &gt;= 300 &amp;&amp; nitrous = true)<br />dead = true<br />else <br />dead = false <br />end if <br />else<br />dead = false <br />end if</div>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP5: Construct the Main Program</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="9"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<p><span size="2">
<ul>
<li>Create an array of Racer objects that will hold&nbsp;two Racer objects.</li>
<li>Write a method called CollectRacerInformation that accepts as an argument a Racer object, and then prompts the user to provide the following information for each racer:<ol type="a">
<li>Racer name;</li>
<li>Racer Speed;</li>
<li>Number of cylinders in the racer's engine;&nbsp;&nbsp;</li>
<li>Horsepower of the racer's engine; and&nbsp;</li>
<li>Nitrus or blower option, depending on the type of Racer object.</li>
</ol>[<strong>Hint:</strong> In order to be able to collect <strong>all</strong>information for the derived classes as well, consider creating a base class method called ReadRacerData in the Racer class, which you will then override in the derived classes to capture the required info per class. Call the ReadRacerData method within the CollectRacerInformation method.]</li>
<li>Write a method called "DisplayRacerInformation" that accepts as an argument a Racer object, and then displays all of the information for the specific racer type.</li>
<li><font size="2"></font></li>
<li>Create a racer object of each type, and invoke the CollectRacerInformation passing in the Racer object. Then, store each object in the array.</li>
<li><font size="2"></font></li>
</ul>
</span></p>
<ol type="1">
<li><span size="2">Iterate through the Racer array list and, for each Racer, display all of the Racer's attribute information (call the DisplayRacerInformation method for each object). Don&rsquo;t forget to indicate whether or not the Racer is dead! </span></li>
</ol>
<table cellspacing="0" cellpadding="4" width="100%">
<tbody>
<tr valign="bottom">
<td bgcolor="#ccddff">
<p><span color="#000080" size="2"><strong>STEP 6: Compile and Test</strong></span></p>
</td>
<td bgcolor="#ccddff"><a href="http://www.chegg.com/a/j/tiny_mce/undefineda/j/tiny_mce/#top" jquery1339640189484="10"><img alt="Back to top" src="http://www.chegg.com/ec/Courses/13775/CRS-DVUO-2148869/Images/021805ibtt.gif" align="right" border="0" /></a></td>
</tr>
</tbody>
</table>
<p><span size="2">When done, compile and run your program. </span></p>
<p><span size="2">Then, debug any errors until your code is error-free.</span></p>
<p><span size="2">Check your output to ensure that you have the desired output and modify your code as necessary and rebuild. Your code may resemble the following:</span></p>
<blockquote>
<p><img alt="" hspace="8" src="http://www.chegg.com/currentcourse/graphics/CIS247A_W7_Lab_Output.gif" vspace="8" /></p>
</blockquote>

Explanation / Answer

No fig here. re post it i will help u :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote