Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the definition of the following class: (1, 2, 3, 5, 7) class productTyp

ID: 3585151 • Letter: C

Question

Consider the definition of the following class: (1, 2, 3, 5, 7) class productType //Line 1 //Line 2 //Line 3 //Line 4 //Line 5 productType (string, int, double, double) //Line 6 public: productType ): productType (int, double, double) productType (string, string, string int, double, double); //Line 7 void set (string, string, string, int, //Line 8 //Line 9 double, double); void print) const void setQuantitiesInStock (int x); void updateQuantitiesInStock (int x); int getQuantitiesInStock () const //Line 10 //Line 11 //Line 12 void setPrice (double x) double getPrice ) const; void setDiscount (double d); double getDiscount ) const; //Line 13 //Line 14 //Line 15 //Line 16 //Line 17 //Line 18 //Line 19 //Line 20 //Line 21 //Line 22 //Line 23 //Line 24 private: string productName; string id; string manufacturer; int quantitiesInStock; double price; double discount; di Give the line number containing the constructor that is executed in each of the following declarations. a. i. productType productl; ii. productType product2 ("Microwave", "M3562", "GeneralPool", 35, 175.00, 0.1); ii. productType product3 ("D1290", 25, 375.00, 0.05) iv. productType product4 (10, 8.50, 0.2); Write the definition of the constructor in Line 4 so that the instance variables are initialized to "", " ", "", o, 0.0, and o.o, respectively. b.

Explanation / Answer

a. Answers:

i. Line 4 - default constructor productType()

ii. Line 7 - constructor productType(string,string,string,int,double,double)

iii.Line 6 - constructor productType(string,int,double,double)

iv. Line 5 - constructor productType(int,double,double)

b. Answers: Difinition of productType()

productType::productType(){

productName="";

id="";

manufacturer="";

quantitiesInStock=0;

price=0.0;

discount=0.0;

}