Suppose that the Customer class is going to be expanded to keep track of total year-to-date purchases.Declare data fields, accessors and mutators which will keep track of the total number of sales and total sales for each instance of Customer.
#include <iostream>
#include <string>
#include <math.h>
#include <cstring>
#include <fstream>
usingnamespace std;
class Customer
{
public:
Customer(); //Object constructor
double increase_limit(double amount); //increases credit limit
double individual_customer_sales() const;
double credit_limit() const;
double total_sales() const;
double compare() const;
void read() const; //mutator
void print() const; // display stuff
bool add_sales(Customer x) const; //accessor
private:
string name;
string address;
string city;
string state;
string zipcode;
double credit_limit;
double customer_sales[];
double total_sale;
double initial_sales;
double purchase_price;
};
Customer::Customer()
{
name = " ";
address= " ";
city = " ";
state = " ";
zipcode = " ";
int i = 0;
int x = i++;
double initial sales = 0.0;
}
double Customer::increase_limit(double amount)
{
credit_limit = credit_limit + amount;
}
double Customer::credit_limit() const
{
max_limit = credit_limit
}
double Customer::indiviual_customer_sales();
{
customer_sales = customer_sales + initial sales
}
double Customer::total_sales()
{
total_sale = customer_sales*x
}
double Customer::compare() const
{
if (purchase_price > max_limit)
{
cout << "CREDIT LIMIT EXCEDDED!!!";
return 0;
}
}
bool Customer::add_sales(Customer x) const
{
if (customer_sales > x.customer_sales)
{
returntrue;
}
else
{
returnfalse;
}
}
void Customer::read() const
{
cout >> "Please enter your name: ";
cin << name;
cout >> "Please enter your address: ";
cin << address;
cout >> "Please enter the city name: ";
cin << city;
cout >> "Please enter the state: ";
cin << state;
cout >> "Please enter the purchase price. "
cin << purchase_price;
cout >> "Please enter number of individual sales: ";
cin << customer_sales;
string remainder; // read remainder of line
getline(cin, remainder)
}
int main()
{
Customer y = Customer();
bool total = truewhile (total)
{
Customer x = customer();
x.read();
if (add_sales(y))
{
y = x;
}
cout << "Here are the total sales!: " << total_sales();
cout << "Would you like to see individual sales? (y/n) ";
string answer;
getline(cin, answer);
if (answer != "y")
{
total = false;
}
else (answer = "y")
{
cout << customer_sales;
}
}
y.print();
return 0;
}
My Question is, how do I accomplish the goal I stated at the top? I am completely stumped and this is due tomorrow. I've chipped away at it over the past few days and can't figure it out.
I'm still receiving over 25 errors from your code. Make sure you're attempting to compile it and try to fix as many errors as possible before resubmitting it. If there are errors you can't figure out, paste the error and line number and I'll help you correct your problem.