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 toy’s 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
3.25 Rating (151 Votes )
There are 3 Steps involved in it
To solve the problem we need to create a C program that defines a class nerfGun which models a toy nerf gun with attributes and methods for managing its functionality Heres a stepbystep guide and expl... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
60618495aad33_55366.pdf
180 KBs PDF File
60618495aad33_55366.docx
120 KBs Word File
