Question: Need help to finish some self-define functions and linked them together. The requirements are specified in the program. Here is what I have so far.
Need help to finish some self-define functions and linked them together. The requirements are specified in the program. Here is what I have so far.
Program can be modify in any manner, thanks.
#include
#include
#include
#include
using namespace std;
struct car // structure for the cars
{
int price; //between 0-9999
string color[7] = " red", "blue", "white", "black", "gray", "green", "yellow";
int Vin; //positive whole number, 5 chars, should have two A-to-Z chars. Randomly generated
int year; //between 1950 and 2017. Randomly generated
string owner; //One word string, having only a-z and A-Z.
};
class BagDyn
{
public:
BagDyn(); // construction
bool Add(int n); // Add, true if successfully added
bool Remove(int n); // Remove the last car in this bag
bool RemoveCarbyVin // Remove car by Vin number.
unsigned int getSize(); // current number of items in the bag
bool SearchVin(int s); // search car with Vin
void ListVinByColor(); // List VINs of the cars what are specified by a color.
void ListVinByOwner(); // List VINs of the cars what are specified by owner name.
private:
int * data ;
unsigned int size;
unsigned int capacity;
};
BagDyn::BagDyn() // create a bag to contain 1000 cars
{
data = NULL;
capacity = 1000;
data = new int[capacity];
{
cout << "A bag to keep " << capacity << " items is created and ready to use" << endl;
}
}
unsigned int BagDyn::getSize() // current number of items in bag.
{
return size;
}
int main()
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
