[Solved] SOLVED:Lab 11 Superhero Friends

$25

File Name: SOLVED:Lab_11__Superhero_Friends.zip
File Size: 301.44 KB

SKU: [Solved] SOLVED:Lab 11 — Superhero Friends Category: Tag:
5/5 - (1 vote)

This lab is a fun (& silly) departure from our focus on the practical use and implementation of complex STL data structures and iterators. You will create two new classes that represent individual superheroes (Superhero) and teams of superheroes (Team). We provide sample code in the main.cpp le demonstrating how these classes should behave and interact. This lab will give you practice overloading operators. Checkpoint 1 First create the Superhero class that stores the heros name, their true identity, and their superhuman power, all as strings. You should write read-only accessor functions to get the heros name and power. However, it is important that each superheros true identity remain a secret, so it must not be accessible through the public interface. The only way to discover a superheros true identity is to correctly guess their true identity by using the operator== and operator!= functions. See the examples in the main.cpp le. Complete the necessary implementation so that the code compiles and runs successfully (with no assertion failures). To complete this checkpoint: Show one of the TAs your implementation. Checkpoint 2 In the sample code we use the unary operator- to negate (a.k.a. corrupt) a superhero. Superheroes are initially good, but turn to evil if corrupted. Likewise, the operation can be applied in reverse to turn an evil supervillain into a good superhero. Another fun example is operator that can be used to settle debates about which heros superpower is greater. Our test cases do not fully specify the dierences in greatness for all powers. Your task is to dene and implement a ranking system for the remaining powers. However, it is important to note that this property is not necessarily transitive; that is, if a b and b c, it does not necessarily hold that a c. To complete this checkpoint: Show a TA these additions and the test output. Checkpoint 3 The nal component of the lab is to nish the implementation for teams of superheroes. Various versions of operator+, operator+=, and operator-= are used in the example code to build, add to, remove from, and merge teams. Study carefully the provided prototypes and the parameter and return types of each of these operators. Your job is to implement these operators. We provide the implementation of a Team member function to get the name of the team. This name is automatically formed by taking the rst consonant of the rst team members true identity, the rst vowel of the rst team members true identity, the rst consonant of the second team members true identity, the rst vowel of the second team members true identity, etc. You will need to add a friend relationship to compile this code. Finally, be creative and select an operator that has not yet been overloaded and prepare a story behind how it is used on superheroes or teams of superheroes. You do not need to implement this operator. To complete this checkpoint and the entire lab: Show a TA your completed program and discuss your proposed new operator.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Lab 11 Superhero Friends
$25