CIS247 WK7 Lab

$29.99
0 ratings

iLab 7 of 7: Putting It All Together

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.

Due this week:

Capture the console output window and paste it into a Word Document;

Zip the project folder; and

Put the zip file and screenshots (Word document) in the Dropbox.

i L A B O V E R V I E W

Scenario and Summary

Deliverables

i L A B S T E P S

STEP 1: Understand the UML Diagram

Image Description

1. Create a project called "CIS247_WK7_Lab_LASTNAME".

Build the class structure shown in the UML diagram. Remember to include properties for each class

attribute.

2.

Provide suitable logic for the ToString method. As always, the ToString method should reveal the state

of an object.

1.

2. For the IsDead() method in HotRod, use the logic to implement the base class abstract IsDead method.

Hint: To generate a random number, use the following code, which returns a random number from 0 to 1:

Random rnd = new Random();

rnd.NextDouble();

STEP 2: Build the Inheritance Hierarchy

STEP 3: Implement the Logic for the HotRod Class

Provide suitable logic for the ToString method. As always, the ToString method should reveal the state

of an object.

1.

For the IsDead method in StreetTurner, use the logic below to implement the inherited abstract base

class method called IsDead.

2.

1. Create an array of Racer objects that will hold two Racer objects.

2. Write a method called CollectRacerInformation that accepts as an argument a Racer object, and then

STEP 4: Implement the logic for the StreetTurner class

STEP5: Construct the Main Program

a. Racer name;

b. Racer Speed;

c. Number of cylinders in the racer's engine;

d. Horsepower of the racer's engine; and

e. Nitrus or blower option, depending on the type of Racer object.

[Hint: In order to be able to collect all 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.]

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.

3.

Create a racer object of each type, and invoke the CollectRacerInformation passing in the Racer object.

Then, store each object in the array.

4.

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’t forget to indicate whether or not the

Racer is dead!

5.

When done, compile and run your program.

Then, debug any errors until your code is error-free.

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:

STEP 6: Compile and Test

Capture the console output window and paste into a Word document.

Put the zip file and screen shots (Word document) in the Dropbox.

I want this!
Size
84.5 KB
Copy product URL
$29.99

CIS247 WK7 Lab

0 ratings
I want this!