Program You will create a backend for organizing data for a

Program

You will create a backend for organizing data for a store. The program will span three homeworks. All homeworks will be based on this UML Diagram. You will incrementally create the classes and indicated member functions each week. By the end, all classes and functions will be fully implemented.

This program will be tested using only your objects and their methods / member functions using a driver program created by the graders. However, you will need to create a \"driver program\" that you can run to develop and test your code. In the driver program, you can set things up to test your objects. See the end of the page for some guidance on creating a driver program.

Requirements

Based on the UML Diagram, create the Customer, and Product classes.

Include all attributes / data members as indicated in the UML Diagram.

Implement the constructors and the methods / member functions listed below.

Note: Not all methods will be implemented in this homework. The remaining class and methods / member functions will be implemented in subsequent homeworks.

Separate Files

Each class should be in a separate file with its own headerfile. By convention, the class name matches the name of the source (.cpp) and header (.h) files. Do not forget to use header guards.

Product Class

Product(int productID, string productName);

string getDescription();

void setDescription(string description);

string getName();

int getID();

int getNumberSold();

double getTotalPaid();

int getInventoryCount();

Customer Class

Customer(string name, int customerID, bool credit);
Credit means that the customer\'s balance is allowed to become negative. If they have credit and they make a purchase with insufficient funds in their balance, the purchase is allowed. Otherwise, they are limited to purchases that can be paid by their balance.

string getName();

void setName(string name);

int getID();

bool getCredit();

void setCredit(bool hasCredit)

double getBalance();

Driver Program Guidance

Your driver program will help you test and debug your objects as you create them. A nice thing about using a driver program, is you do not have to validate all of the inputs. You are only using it for testing, so you can ensure that the inputs that come in are valid. However, you still have to do validation that a member function is expected to do, e.g. when an exception is thrown.

Initially, you will probably want to create and test the Product class since it does not rely on any other class. So testing means creating and being able to see values in in the class and trying both valid and invalid inputs. So in this case we may want create the constructor and the getters for the two values passed into the constructor. So after creating my Product class (Product.h and Product.cpp), I can go ahead and implement getID() and getProductName(). So my initial main might look something like this:

Main.cpp

Looking at the results, you want to see that the values you passed into the constructor are the same values you output. If not, there is probably something wrong with the constructor.

As the program progresses, you will add more actions leading up to whatever part you are testing. You also might need to change things. You might want to comment out sections that are not relevant to current testing rather than deleting them, because you might need to ressurect those actions later in testing.

Regradless, you may want to eventually create an interactive menu driven program, where each option is a function to test. At one point I created a skeleton driver program that most students found too complicated to integrate. However, it sets up a menu driven program that can be run interactively. Alternatively, filenames can be passed in using command line arguments, that runs a list of actions listed in a file. Output can also be sent to a file. If commands are in a file, each line represents an action. The first character will be the menu option followed by a list of parameters you need for the functions. You probably want to put any strings that can have spaces (e.g. a name) at the end of the line so you can use getline to get the string including spaces. If you are interested in this skeleton, you can find it here: driver.cpp

Solution

product.h file :

customer.cpp :

}

customer.h :

#endif

#include <iostream>
Program You will create a backend for organizing data for a store. The program will span three homeworks. All homeworks will be based on this UML Diagram. You w
Program You will create a backend for organizing data for a store. The program will span three homeworks. All homeworks will be based on this UML Diagram. You w

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site