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, 24.06.2019 03:30
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
Answers: 2
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
Computers and Technology, 24.06.2019 23:00
Why is it preferable to code web pages in html format? a. to create more lines code b. to apply general formatting rules c. to display properly as search results in all browsers d. to add meaning to the document
Answers: 1
Computers and Technology, 25.06.2019 04:10
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
Consider the definition of the following class: (1, 2, 3, 5, 7)
class productType //Line 1
English, 29.07.2019 17:40
History, 29.07.2019 17:40
Chemistry, 29.07.2019 17:40
Mathematics, 29.07.2019 17:40
History, 29.07.2019 17:40
Geography, 29.07.2019 17:40