You need to write a class sship spaceship it is to have


Question: You need to write a class sship (spaceship) , it is to have the following private member data:

a. Int ID;

b. String stype;

c. Int manabilty; ///short for maneuverability

d. Int firep; ///short for firepower

e. Int Hits /// number of hits it can sustain

Create two instances of sship, ID=1 is stype Xwing, ID=2 is stype Starfighter. ID 1, has manabilty = 77 and firepower = 80, hits = 3 ID 2, has manability 85 and firepower 66, hits = 2 Allow them to fight in the following manner: ID 1 rolls a random number with mean=firepower, standard deviation = 10 if this is greater than the manability of ID 2 then ID 2 hit count is reduced by 1 ID 2 rolls a random number with mean=firepower, standard deviation = 10, if this is greater than the manability of ID 1 then ID 1 hit count is reduced by 1 Repeat until one is destroyed. Display the winner to the screen. Repeat combat 100 times in a loop, and report the number of wins for ID 1, ID 2 and the number of times they are both destroyed. c++ code.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: You need to write a class sship spaceship it is to have
Reference No:- TGS02288224

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)