Edwards Manufacturing Company purchases two component parts from three different suppliers.
The suppliers have limited capacity, and no one supplier can meet all the company’s needs. In
addition, the suppliers charge different prices for the components. Component price data (in
price per unit) are as follows:
Each supplier has a limited capacity in terms of the total number of components it can supply.
However, as long as Edwards provides sufficient advance orders, each supplier can devote its
capacity to component 1, component 2, or any combination of the two components, if the total
number of units ordered is within its capacity. Supplier capacities are as follows:
If the Edwards production plan for the next period includes 1000 units of component 1 and 800
units of component 2, what purchases do you recommend? That is, how many units of each
component should be ordered from each supplier? Round your answers to the nearest whole
number.
What is the total purchase cost for the components? Round your answer to the nearest dollar.
$ ????SupplierComponent1231$11$10$132$10$11$11
Solution
For component 1:
supplier 2 have minimum cost and capacity 1050.
So all the component 1 (1000) can be purchased from supplier 2.
So, supplier 2 have 50 more capacity.
Now, supplier 1 have minimum cost for component 2 and have capacity of 650.
so, number of component 2 from supplier1 can be 650.
Now, we need 150 more component 2.
supplier 2 and 3 have same cost for component 2.
supllier have only 50 capacity now and supplier have 850.
So, 150 component 2 can be purchased from supplier 3.
Let y be the number of components fromSupplier123TotalcostComponent
1010000100010000Component 265001508008150Total cost18150.
I have the following code and I need to know why I am receiving the .pdf
1. I have the following code and I need to know why I am receiving the following errors:
Error 1 error C2436: '{ctor}' : member function or nested class in constructor initializer list
(line 287)
Error 2 error C2436: '{ctor}' : member function or nested class in constructor initializer list
(line 385)
#include
#include
#include
#include
using namespace std;
enum contactGroupType
{// used in extPersonType
FAMILY,
FRIEND,
BUSINESS,
UNFILLED
};
class addressType
{
private:
string st_address;
string city;
string state;
int zip;
public:
void print(string, string, string, int)const;
void setStreet(string);
string getStreet()const;
void setCity(string);
string getCity()const;
void setState(string);
string getState()const;
void setZip(int);
int getZip()const;
void set(string, string, string, int);// set all address fields
2. string get()const;// get address as one concatenated string
addressType();
// ~addressType();
};
class personType
{
private:
string firstName;
string lastName;
public:
void print()const;
void setName(string first, string last);
string getFirstName()const;
string getLastName()const;
string get()const;// return First Last names concatenated
personType & operator=(const personType &);
personType(string, string);
personType();
};
class dateType
{
private:
int dMonth;
int dDay;
int dYear;
public:
void setDate(int month, int day, int year);
int getDay()const;
int getMonth()const;
int getYear()const;
void print()const;
string get()const;// return string representation as DD/MM/YYYY
dateType & operator=(const dateType & d);
dateType(int, int, int);
dateType();
};
3. class extPersonType :public personType {
private:
addressType address;// added members
dateType birthday;
contactGroupType group;
string phone;
public:
// methods
void setPhone(string);
string getPhone()const;
void setGroup(contactGroupType);
contactGroupType getGroup()const;
void setBirthday(int, int, int);
dateType getBirthday()const;
void print();
string get()const;// return string representation of ext person type
extPersonType & operator=(const extPersonType & p);
string groupToString(contactGroupType)const;
contactGroupType extPersonType::stringToGroup(string)const;
// constructors
extPersonType();
extPersonType(string first, string last);
};
// because we have no arrayListType, we are using our own
// implementation with a small subset of functions
class arrayListType
{
extPersonType array[500];
int size;
public:
arrayListType();
extPersonType & operator[](int i);
void removeLast();// remove last element
void add(const extPersonType &);// add new element
int getSize()const;// get array size
};
4. class addressBookType :public arrayListType
{
private:
static const char FS = 't';// field separator in file (TAB char)
int current;// current position
string fileName;// filename
fstream fileStream;// file as fstream
/* filiters */
contactGroupType fltGroup;
string fltFromLast, fltToLast;
dateType fltFromDate, fltTiDate;
/* flags for effective filters */
bool fltStatus, fltLast, fltDateRange, fltDate;
/* field numbering in the file */
static const int _first = 0;
static const int _last = 1;
static const int _street = 2;
static const int _city = 3;
static const int _state = 4;
static const int _phone = 5;
static const int _zip = 6;
static const int _year = 7;
static const int _month = 8;
static const int _day = 9;
static const int _group = 10;
static const int _end = _group;
public:
addressBookType();
bool readFile(string);// read file into addressBook array
bool writeFile(string);// pass filename, write to file
void reset();// reset 'current' position
extPersonType * getNext();// allows to navigate in forward direction
/* by group name */
void setFilterStatus(contactGroupType);
/* by last name */
void setFilterLastname(string from, string to);// define range
5. /* by birthday */
void setFilterBirthday(dateType from, dateType to);
/* clear all filters */
void clearFilters();
void print(int i);// print personal data of [i] person
};
// Main program
int main()
{
return 0;
}
/*****************implementation of print & set function*****/
// constructor with parameters
addressType::addressType()
{
st_address = "";
city = "";
state = "";
zip = 0;
}
void addressType::set(string addr, string city, string state, int zip)
{
this->st_address = addr;
this->city = city;
this->state = state;
this->zip = zip;
}
void addressType::setStreet(string street)
{
this->st_address = street;
}
string addressType::getStreet()const
{
return this->st_address;
}
void addressType::setCity(string street)
12. {
fltStatus = fltDate = fltLast = fltDateRange = false;
}
/* Read array from file, return false on error */
bool addressBookType::readFile(string filename)
{
string line;
string fields[_end + 1];// _last index of the last field
extPersonType p;// temporary 'person' instance
int pos1 = 0, pos2 = 0, index;
fileStream.open(filename.c_str(), ios::in);
reset();// reset 'current' counter
clearFilters();
while (!fileStream.eof()){// read line by line
fileStream >> line;
// fields are in the following order:
// first, last, street, city, state, zip, phone, status, year, month, day
for (index = 0; index <= _end; index++) fields[index] = "";// initialize
pos2 = 0; pos1 = -1;
index = 0;
do
{// read field by field
pos1 = pos2 + 1;// +1 is for field separator
pos2 = line.find(FS, pos1);
fields[index] = line.substr(pos1, pos2 - pos1);// get field from line
index++;
}
while (pos2 >= 0 && index <= _end);
// now fields[] are filled with fields from file
p.setName(fields[_first], fields[_last]);
p.setPhone(fields[_phone]);
p.setGroup(p.stringToGroup(fields[_group]));// convert string to enum
// set birthday
p.getBirthday().setDate(atoi(fields[_month].c_str()),
atoi(fields[_day].c_str()),
atoi(fields[_year].c_str()));
13. // add 'p' to array
this->add(p);
}
// while () next line from file
fileStream.close();
return true;
}
// Write to file (stub)
bool addressBookType::writeFile(string filename)
{
return true;
}
Solution
actually the problem is with lines 285 and 384 erase the lines and try with my code u will be
getting
#include
#include
using namespace std;
enum contactGroupType
{// used in extPersonType
FAMILY,
FRIEND,
BUSINESS,
UNFILLED
};
class addressType
{
private:
string st_address;
string city;
string state;
int zip;
public:
void print(string, string, string, int)const;
14. void setStreet(string);
string getStreet()const;
void setCity(string);
string getCity()const;
void setState(string);
string getState()const;
void setZip(int);
int getZip()const;
void set(string, string, string, int);// set all address fields
string get()const;// get address as one concatenated string
addressType();
// ~addressType();
};
class personType
{
private:
string firstName;
string lastName;
public:
void print()const;
void setName(string first, string last);
string getFirstName()const;
string getLastName()const;
string get()const;// return First Last names concatenated
personType & operator=(const personType &);
personType(string, string);
personType();
};
class dateType
{
private:
int dMonth;
int dDay;
int dYear;
public:
void setDate(int month, int day, int year);
15. int getDay()const;
int getMonth()const;
int getYear()const;
void print()const;
string get()const;// return string representation as DD/MM/YYYY
dateType & operator=(const dateType & d);
dateType(int, int, int);
dateType();
};
class extPersonType :public personType {
private:
addressType address;// added members
dateType birthday;
contactGroupType group;
string phone;
public:
// methods
void setPhone(string);
string getPhone()const;
void setGroup(contactGroupType);
contactGroupType getGroup()const;
void setBirthday(int, int, int);
dateType getBirthday()const;
void print();
string get()const;// return string representation of ext person type
extPersonType & operator=(const extPersonType & p);
string groupToString(contactGroupType)const;
contactGroupType extPersonType::stringToGroup(string)const;
// constructors
extPersonType();
extPersonType(string first, string last);
};
// because we have no arrayListType, we are using our own
// implementation with a small subset of functions
class arrayListType
{
16. extPersonType array[500];
int size;
public:
arrayListType();
extPersonType & operator[](int i);
void removeLast();// remove last element
void add(const extPersonType &);// add new element
int getSize()const;// get array size
};
class addressBookType :public arrayListType
{
private:
static const char FS = 't';// field separator in file (TAB char)
int current;// current position
string fileName;// filename
fstream fileStream;// file as fstream
/* filiters */
contactGroupType fltGroup;
string fltFromLast, fltToLast;
dateType fltFromDate, fltTiDate;
/* flags for effective filters */
bool fltStatus, fltLast, fltDateRange, fltDate;
/* field numbering in the file */
static const int _first = 0;
static const int _last = 1;
static const int _street = 2;
static const int _city = 3;
static const int _state = 4;
static const int _phone = 5;
static const int _zip = 6;
static const int _year = 7;
static const int _month = 8;
static const int _day = 9;
static const int _group = 10;
static const int _end = _group;
public:
17. addressBookType();
bool readFile(string);// read file into addressBook array
bool writeFile(string);// pass filename, write to file
void reset();// reset 'current' position
extPersonType * getNext();// allows to navigate in forward direction
/* by group name */
void setFilterStatus(contactGroupType);
/* by last name */
void setFilterLastname(string from, string to);// define range
/* by birthday */
void setFilterBirthday(dateType from, dateType to);
/* clear all filters */
void clearFilters();
void print(int i);// print personal data of [i] person
};
// Main program
int main()
{
return 0;
}
/*****************implementation of print & set function*****/
// constructor with parameters
addressType::addressType()
{
st_address = "";
city = "";
state = "";
zip = 0;
}
void addressType::set(string addr, string city, string state, int zip)
{
this->st_address = addr;
this->city = city;
this->state = state;
this->zip = zip;
}
24. {
reset();
clearFilters();
}
void addressBookType::reset()
{
current = 0;
}
void addressBookType::clearFilters()
{
fltStatus = fltDate = fltLast = fltDateRange = false;
}
/* Read array from file, return false on error */
bool addressBookType::readFile(string filename)
{
string line;
string fields[_end + 1];// _last index of the last field
extPersonType p;// temporary 'person' instance
int pos1 = 0, pos2 = 0, index;
fileStream.open(filename.c_str(), ios::in);
reset();// reset 'current' counter
clearFilters();
while (!fileStream.eof()){// read line by line
fileStream >> line;
// fields are in the following order:
// first, last, street, city, state, zip, phone, status, year, month, day
for (index = 0; index <= _end; index++) fields[index] = "";// initialize
pos2 = 0; pos1 = -1;
index = 0;
do
{// read field by field
pos1 = pos2 + 1;// +1 is for field separator
pos2 = line.find(FS, pos1);
fields[index] = line.substr(pos1, pos2 - pos1);// get field from line
index++;
}
25. while (pos2 >= 0 && index <= _end);
// now fields[] are filled with fields from file
p.setName(fields[_first], fields[_last]);
p.setPhone(fields[_phone]);
p.setGroup(p.stringToGroup(fields[_group]));// convert string to enum
// set birthday
p.getBirthday().setDate(atoi(fields[_month].c_str()),
atoi(fields[_day].c_str()),
atoi(fields[_year].c_str()));
// add 'p' to array
this->add(p);
}
// while () next line from file
fileStream.close();
return true;
}
// Write to file (stub)
bool addressBookType::writeFile(string filename)
{
return true;
}