
Concept explainers
A)
Enumeration:
Enumeration is a user-defined data type which consists of enumerators; the enumerators are used to represent integer constants.
- An enumeration can be defined by using the keyword “enum”.
- By default, the values of enumeration type are filled with “0” to “n” sequentially and those default values can be changed when declaring the enumeration.
- In a sequence of enumerators, if the first enumerator is assigned with a “user-defined value” and the next enumerator is not assigned with any value, then by default the next enumerator will be filled by the value “user-defined value of previous enumerator plus 1”.
- The type name of an enumeration is optional; if name of the enumeration type is not given then it is referred as “anonymous”.
Syntax:
Syntax to declare an enumerated data type is as follows,
enum type_name {identifier_1, identifier_2, identifier_3, … identifier_n};
In the above syntax,
- “enum” is the keyword used to declare an enumerator.
- “type_name” refers the name of the type of the enumerator.
“identier_1” to “identifier_n” are refers the list of the identifiers declared in the enumerator.
Given statement:
enum Department {Purchasing, Manufacturing, Warehouse, Sales};
Department floor1, floor2;
int dNum = 2;
- Here, an “enum” is a keyword and “Department” is the variable name of an enumeration. “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are the values used in the enumeration.
- The variable name “floor1” and “floor2” of type “Department” is defined. These two variables can only store any one of the four values (Purchasing, Manufacturing, Warehouse, Sales).
- “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are treated as integers by complier.
- Once enumerators are defined, their value cannot be changed in program.
B)
Enumeration:
Enumeration is a user-defined data type which consists of enumerators; the enumerators are used to represent integer constants.
- An enumeration can be defined by using the keyword “enum”.
- By default, the values of enumeration type are filled with “0” to “n” sequentially and those default values can be changed when declaring the enumeration.
- In a sequence of enumerators, if the first enumerator is assigned with a “user-defined value” and the next enumerator is not assigned with any value, then by default the next enumerator will be filled by the value “user-defined value of previous enumerator plus 1”.
- The type name of an enumeration is optional; if name of the enumeration type is not given then it is referred as “anonymous”.
Syntax:
Syntax to declare an enumerated data type is as follows,
enum type_name {identifier_1, identifier_2, identifier_3, … identifier_n};
In the above syntax,
- “enum” is the keyword used to declare an enumerator.
- “type_name” refers the name of the type of the enumerator.
“identier_1” to “identifier_n” are refers the list of the identifiers declared in the enumerator.
Given statement:
enum Department {Purchasing, Manufacturing, Warehouse, Sales};
Department floor1, floor2;
int dNum = 2;
- Here, an “enum” is a keyword and “Department” is the variable name of an enumeration. “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are the values used in the enumeration.
- The variable name “floor1” and “floor2” of type “Department” is defined. These two variables can only store any one of the four values (Purchasing, Manufacturing, Warehouse, Sales).
- “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are treated as integers by complier.
- Once enumerators are defined, their value cannot be changed in program.
C)
Enumeration:
Enumeration is a user-defined data type which consists of enumerators; the enumerators are used to represent integer constants.
- An enumeration can be defined by using the keyword “enum”.
- By default, the values of enumeration type are filled with “0” to “n” sequentially and those default values can be changed when declaring the enumeration.
- In a sequence of enumerators, if the first enumerator is assigned with a “user-defined value” and the next enumerator is not assigned with any value, then by default the next enumerator will be filled by the value “user-defined value of previous enumerator plus 1”.
- The type name of an enumeration is optional; if name of the enumeration type is not given then it is referred as “anonymous”.
Syntax:
Syntax to declare an enumerated data type is as follows,
enum type_name {identifier_1, identifier_2, identifier_3, … identifier_n};
In the above syntax,
- “enum” is the keyword used to declare an enumerator.
- “type_name” refers the name of the type of the enumerator.
“identier_1” to “identifier_n” are refers the list of the identifiers declared in the enumerator.
Given statement:
enum Department {Purchasing, Manufacturing, Warehouse, Sales};
Department floor1, floor2;
int dNum = 2;
- Here, an “enum” is a keyword and “Department” is the variable name of an enumeration. “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are the values used in the enumeration.
- The variable name “floor1” and “floor2” of type “Department” is defined. These two variables can only store any one of the four values (Purchasing, Manufacturing, Warehouse, Sales).
- “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are treated as integers by complier.
- Once enumerators are defined, their value cannot be changed in program.
D)
Enumeration:
Enumeration is a user-defined data type which consists of enumerators; the enumerators are used to represent integer constants.
- An enumeration can be defined by using the keyword “enum”.
- By default, the values of enumeration type are filled with “0” to “n” sequentially and those default values can be changed when declaring the enumeration.
- In a sequence of enumerators, if the first enumerator is assigned with a “user-defined value” and the next enumerator is not assigned with any value, then by default the next enumerator will be filled by the value “user-defined value of previous enumerator plus 1”.
- The type name of an enumeration is optional; if name of the enumeration type is not given then it is referred as “anonymous”.
Syntax:
Syntax to declare an enumerated data type is as follows,
enum type_name {identifier_1, identifier_2, identifier_3, … identifier_n};
In the above syntax,
- “enum” is the keyword used to declare an enumerator.
- “type_name” refers the name of the type of the enumerator.
“identier_1” to “identifier_n” are refers the list of the identifiers declared in the enumerator.
Given statement:
enum Department {Purchasing, Manufacturing, Warehouse, Sales};
Department floor1, floor2;
int dNum = 2;
- Here, an “enum” is a keyword and “Department” is the variable name of an enumeration. “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are the values used in the enumeration.
- The variable name “floor1” and “floor2” of type “Department” is defined. These two variables can only store any one of the four values (Purchasing, Manufacturing, Warehouse, Sales).
- “Purchasing”, “Manufacturing”, “Warehouse” and “Sales” are treated as integers by complier.
- Once enumerators are defined, their value cannot be changed in program.

Want to see the full answer?
Check out a sample textbook solution
Chapter 7 Solutions
Starting Out with C++: Early Objects (9th Edition)
- what is a feature in the Windows Server Security Compliance Toolkit, thank you.arrow_forwardYou will write a program that allows the user to keep track of college locations and details about each location. To begin you will create a College python class that keeps track of the csollege's unique id number, name, address, phone number, maximum students, and average tuition cost. Once you have built the College class, you will write a program that stores College objects in a dictionary while using the College's unique id number as the key. The program should display a menu in this order that lets the user: 1) Add a new College 2) Look up a College 4) Delete an existing College 5) Change an existing College's name, address, phone number, maximum guests, and average tuition cost. 6) Exit the programarrow_forwardShow all the workarrow_forward
- Show all the workarrow_forward[5 marks] Give a recursive definition for the language anb2n where n = 1, 2, 3, ... over the alphabet Ó={a, b}. 2) [12 marks] Consider the following languages over the alphabet ={a ,b}, (i) The language of all words that begin and end an a (ii) The language where every a in a word is immediately followed by at least one b. (a) Express each as a Regular Expression (b) Draw an FA for each language (c) For Language (i), draw a TG using at most 3 states (d) For Language (ii), construct a CFG.arrow_forwardQuestion 1 Generate a random sample of standard lognormal data (rlnorm()) for sample size n = 100. Construct histogram estimates of density for this sample using Sturges’ Rule, Scott’s Normal Reference Rule, and the FD Rule. Question 2 Construct a frequency polygon density estimate for the sample in Question 1, using bin width determined by Sturges’ Rule.arrow_forward
- Generate a random sample of standard lognormal data (rlnorm()) for sample size n = 100. Construct histogram estimates of density for this sample using Sturges’ Rule, Scott’s Normal Reference Rule, and the FD Rule.arrow_forwardCan I get help with this case please, thank youarrow_forwardI need help to solve the following, thank youarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage



