I need help on C program Please do not answer if you do not
I need help on C++ program. Please do not answer if you do not know the answer
Store Backend - Part 1
Program
You will create a backend for organizing data for a store.
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 (http://courses.cse.tamu.edu/jmichael/f16/121/homework/9/storeUML.pdf), create the Customer, and Product classes.
Include all attributes / data members as indicated in the UML Diagram (http://courses.cse.tamu.edu/jmichael/f16/121/homework/9/storeUML.pdf).
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.
Thanks in advance. It has to be done in C++
Solution
//Product.h
#ifndef __PRODUCT_H
#define __PRODUCT_H
using namespace std;
class Product
{
public:
int productID;
string description;
string name;
double totalPaid;
int inventoryCount;
int numSold;
Product(int productID, string productName);
string getDescription();
void setDescription(string description);
string getName();
int getID();
int getNumberSold();
double getTotalPaid();
int getInventoryCount();
};
#endif
//Customer.h
#ifndef __CUSTOMER_H
#define __CUSTOMER_H
using namespace std;
class Customer
{
public:
string name;
int customerID;
bool credit;
double balance;
Customer(string name, int customerID, bool credit);
string getName();
void setName(string name);
int getID();
bool getCredit();
void setCredit(bool hasCredit);
double getBalance();
};
#endif
//Product.cpp
#include <iostream>
#include \"Product.h\"
using namespace std;
Product::Product(int productID, string productName)
{
Product::name = productName;
Product::productID = productID;
}
string Product::getDescription(){
return description;
}
void Product::setDescription(string description){
Product::description = description;
}
string Product::getName(){
return Product::name;
}
int Product::getID(){
return Product::productID;
}
int Product::getNumberSold(){
return Product::numSold;
}
double Product::getTotalPaid(){
return Product::totalPaid;
}
int Product::getInventoryCount(){
return Product::inventoryCount;
}
//Customer.cpp
 #include <iostream>
 #include \"Customer.h\"
using namespace std;
 Customer::Customer(string name, int customerID, bool credit){
    Customer::name = name;
    Customer::customerID = customerID;
    Customer::credit = credit;
 }
 string Customer::getName(){
 return name;
 }
 void Customer::setName(string name){
    Customer::name = name;
 }
 int Customer::getID(){
 return Customer::customerID;
 }
 bool Customer::getCredit(){
 return Customer::credit;
 }
 void Customer::setCredit(bool hasCredit){
    Customer::credit = hasCredit;
 }
 double Customer::getBalance(){
 return Customer::balance;
 }
//Main.cpp
#include <iostream>
 #include \"Product.h\"
 #include \"Customer.h\"
 using namespace std;
 int main()
 {
 Product p = Product(777, \"Milk\");
 cout<<\"ID: \"<<p.getID()<<endl;
 cout<<\"Product Name: \"<<p.getName()<<endl;
Customer c = Customer(\"John\", 231, true);
 cout<<\"Customer ID: \"<<c.getID()<<endl;
 cout<<\"Customer Name: \"<<c.getName()<<endl;
 cout<<\"Has Credit? \"<<c.getCredit()<<endl;
 return 0;
 }
OUTPUT:
ID: 777
 Product Name: Milk
 CustomerID: 231
 Customer Name: John
 Has Credit? true





