Question
Task : Create a C++ project that will have 3 source files: a main file (driver program), a class specification file (header file), and a
Task: Create a C++ project that will have 3 source files: a main file (driver program), a class specification file (header file), and a class implementation file. The project will be a simple inventory program to manage your coin collection.
Class:
The Coin class will contain the following data members:
year an int for the year the coin was minted
faceValue a double for holding the original value of the coin
description a dynamically-allocated string holding a description of the coin
quantity an int for holding the quantity on-hand of this coin
marketValue a double for holding the estimated current market value of this coin
totalValue a static member that holds the total market value of the collection
The Coin class will need these member functions:
a constructor function to initialize the data attributes
a destructor function
mutator functions to change the values of each data member. The mutator functions should include basic input validation so that negative numbers are not stored in the quantity or value members, and that year is in an appropriate range (for the sake of simplicity, you may assume that you do not have access to coins created in the B.C. era). Be sure to update the static member as needed.
accessor functions to retrieve the data values
a function to calculate the difference between a coins faceValue and its marketValue
Main processing: Create an array of Coin objects, instantiating at least 3 objects. The driver program should utilize/demonstrate each of the class functions. The driver should be able to display the collection. If needed, you may use the array index as a record key to access different coins. Make sure you program is well documented both internally and externally.
Input: Data may be input by the user or you may create a data file and read the values into your array. If you use a data file, be sure to submit it with your source code files.
Output: Results will be displayed to the screen.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started