Question: In this C++ program, you will create an object and display it. Create a class nerfGun that includes data members model (string), range(int), capacity (int),

In this C++ program, you will create an object and display it. Create a class nerfGun that includes data members model (string), range(int), capacity (int), and number of darts (int). Your class should have a constructor with three parameters (assume the toy is fully loaded when created). Assume that model and range is correct, but check to make sure capacity is <= 144. Provide a member function getModel(), getCapacity(), getDartCount(), fire() and reload(quantity). The method fire() reduces the number of darts.The method reload(quantity) should increase the number of darts by the quantity provided but must ensure the number of darts do not exceed the toys capacity . Write a program that creates, fires, and reloads two different nerf guns. Run your program with at least three different sets of data.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!