subject

Consider the definition of the following class: (1, 2, 3, 5, 7) class productType //Line 1

{ //Line 2

public: //Line 3

productType(); //Line 4

productType(int, double, double); //Line 5

productType(string, int, double, double); //Line 6

productType(string, string, string,

int, double, double); //Line 7

void set(string, string, string, int,

double, double); //Line 8

void print() const; //Line 9

void setQuantitiesInStock(int x); //Line 10

void updateQuantitiesInStock(int x); //Line 11

int getQuantitiesInStock() const; //Line 12

void setPrice(double x); //Line 13

double getPrice() const; //Line 14

void setDiscount(double d); //Line 15

double getDiscount() const; //Line 16

private: //Line 17

string productName; //Line 18

string id; //Line 19

string manufacturer; //Line 20

int quantitiesInStock; //Line 21

double price; //Line 22

double discount; //Line 23

}; //Line 24

a. Give the line number containing the constructor that is executed in each of the following declarations.

i. productType product1;
ii. productType product2("Microwave", "M3562", "GeneralPool", 35, 175.00, 0.1);
iii. productType product3("D1290", 25, 375.00, 0.05);
iv. productType product4(10, 8.50, 0.2);

b. Write the definition of the constructor in Line 4 so that the instance variables are initialized to "", "", "", 0, 0.0, and 0.0, respectively.
c. Write the definition of the constructor in Line 5 so that the string instance variables are initialized to "", and the other instance variables are initialized according to the parameters. Instance variables quantitiesInStock, price, and discount must be nonnegative.
d. Write the definition of the constructor in Line 6 so that the instance variables productName and manufacturer are initialized to the empty string, instance variable id is initialized according to the first parameter, and the remaining instance variables are initialized according to the last three parameters. Instance variables quantitiesInStock, price, and discount must be nonnegative.
e. Write the definition of the constructor in Line 7 so that the instance variables are initialized according to the parameters. Instance variables quantitiesInStock, price, and discount must be nonnegative.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone else’s ?
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
How would you cite different books by the same author on the works cited page? moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. –––. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. moore, jack h. folk songs and ballads. salem: poetry press, 1999. print. moore, jack h. ballads in poetry – a critical review. dallas: garden books, 1962. print. –––. folk songs and ballads. salem: poetry press, 1999. print.
Answers: 2
question
Computers and Technology, 24.06.2019 03:30
Explain the importance of html in web page designing in 20 sentences..
Answers: 1
You know the right answer?
Consider the definition of the following class: (1, 2, 3, 5, 7) class productType //Line 1
Questions
question
Biology, 12.11.2020 21:20
question
Advanced Placement (AP), 12.11.2020 21:20
question
Mathematics, 12.11.2020 21:20
question
Mathematics, 12.11.2020 21:20
question
Mathematics, 12.11.2020 21:20
question
Mathematics, 12.11.2020 21:20
Questions on the website: 13722367