Computers and Technology, 28.02.2021 17:10 katswindle11
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.
Answers: 1
Computers and Technology, 22.06.2019 13:30
Asoftware company hired ray, a college graduate to work in their development team. ray is assigned to work in the coding phase of a project. what happens during the coding phase of a software development project? a. the customer receives a working model of the software. b. developers convert the program design into code. c. developers gather requirements directly from the stakeholders. d. testing teams check the product for quality.
Answers: 1
Computers and Technology, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
Consider the definition of the following class: (1, 2, 3, 5, 7)
class productType //Line 1
Mathematics, 09.02.2021 01:30
Arts, 09.02.2021 01:30
Mathematics, 09.02.2021 01:30
Computers and Technology, 09.02.2021 01:30
Mathematics, 09.02.2021 01:30
Social Studies, 09.02.2021 01:30
Mathematics, 09.02.2021 01:30