C1S247 Lab 7 in C# – Guaranteed 100% score
iLab 7 of 7: Putting It All Together
Connect to the iLab here.
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)
i L A B O V E R V I E W
Scenario and Summary
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.
Deliverables
Due this week:
• Before you post your lab in the dropbox, copy your entire program into a Notepad file and post that. I do not need you to zip the project or give me screen shots of the output.
i L A B S T E P S
STEP 1: Understand the UML Diagram
STEP 2: Build the Inheritance Hierarchy
1. Create a project called “CIS247_WK7_Lab_LASTNAME”.
2. Build the class structure shown in the UML diagram. Remember to include properties for each class attribute.
STEP 3: Implement the Logic for the HotRod Class
1. Provide suitable logic for the ToString method. As always, the ToString method should reveal the state of an object.
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();
Pseudocode for the IsDead method of HotRod
Random rnd = new Random();
boolean dead
if (speed > 50 && rnd.NextDouble() > 0.6)
if (engineHorsePower < 300 && blower=true)
dead = false
else
dead = true
end if
else if (speed > 100 && rnd.NextDouble() > 0.4)
if (engineHorsePower >= 300 && blower = true)
dead = true
else
dead = false
end if
else
dead = false
end if
STEP 4: Implement the logic for the StreetTurner class
1. Provide suitable logic for the ToString method. As always, the ToString method should reveal the state of an object.
2. For the IsDead method in StreetTurner, use the logic below to implement the inherited abstract base class method called IsDead.
Pseudocode for the IsDead method of StreetTuner
Random rnd = new Random();
boolean dead
if (speed > 50 && rnd.NextDouble() > 0.6)
if (engineHorsePower < 300 && nitrous=true)
dead = false
else
dead = true
end if
else if (speed > 100 && rnd.NextDouble() > 0.4)
if (engineHorsePower >= 300 && nitrous = true)
dead = true
else
dead = false
end if
else
dead = false
end if
STEP5: Construct the Main Program
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 prompts the user to provide the following information for each racer:
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.]
3. 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.
4. Create a racer object of each type, and invoke the CollectRacerInformation passing in the Racer object. Then, store each object in the array.
5. 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!
STEP 6: Compile and Test
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 7: Submit Deliverables
• Before you post your lab in the dropbox, copy your entire program into a Notepad file and post that. I do not need you to zip the project or give me screen shots of the output.
Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, read these Step-by-Step Instructions or watch this Dropbox Tutorial.
See Syllabus “Due Dates for Assignments & Exams” for due date information.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.