Starting Out with C++
Starting Out with C++
8th Edition
ISBN: 9780133888201
Author: GADDIS
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
bartleby

Concept explainers

Question
Book Icon
Chapter 11, Problem 11RQE
Program Plan Intro

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.

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.

Example:

The example for enumeration is as follows,

//enum definition

enum Average

{

//values of enumeration

Semester_1 = 97,

Semester_2 = 99,

Semester_3 = 86,

Semester_4 = 97,

Semester_5 = 79,

Semester_6 = 88,

};

In the above example,

  • The name of the enumeration is “Average”.
    • The “Semester_1”, “Semester_2”, “Semester_3”, “Semester_4”, “Semester_5”, and “Semester_6” are the six values of type “Average”.
    • The values of type “Average” are assigned with the new set of values.

Blurred answer
Students have asked these similar questions
in C#, Make any necessary modifications to the RushJob class so that it can be sorted by job number. Modify the JobDemo3 application so the displayed orders have been sorted. Save the application as JobDemo4. An example of the program is shown below: Enter job number 22 Enter customer name Joe Enter description Powerwashing Enter estimated hours 4 Enter job number 6 Enter customer name Joey Enter description Painting Enter estimated hours 8 Enter job number 12 Enter customer name Joseph Enter description Carpet cleaning Enter estimated hours 5 Enter job number 9 Enter customer name Josefine Enter description Moving Enter estimated hours 12 Enter job number 21 Enter customer name Josefina Enter description Dog walking Enter estimated hours 2 Summary: RushJob 6 Joey Painting 8 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $510.00 RushJob 9 Josefine Moving 12 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $690.00 RushJob 12 Joseph Carpet cleaning 5…
In C#, Make any necessary modifications to the RushJob class so that it can be sorted by job number. Modify the JobDemo3 application so the displayed orders have been sorted. Save the application as JobDemo4. An example of the program is shown below: Enter job number 22 Enter customer name Joe Enter description Powerwashing Enter estimated hours 4 Enter job number 6 Enter customer name Joey Enter description Painting Enter estimated hours 8 Enter job number 12 Enter customer name Joseph Enter description Carpet cleaning Enter estimated hours 5 Enter job number 9 Enter customer name Josefine Enter description Moving Enter estimated hours 12 Enter job number 21 Enter customer name Josefina Enter description Dog walking Enter estimated hours 2 Summary: RushJob 6 Joey Painting 8 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $510.00 RushJob 9 Josefine Moving 12 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $690.00 RushJob 12 Joseph Carpet cleaning 5…
You are developing a Fraction structure for Teacher’s Pet Software. The structure contains three public data fields for whole number, numerator, and denominator. Using the same structure, write the functions described below: • An enterFractionValue()function that declares a local Fraction object and prompts the user to enter values for the Fraction. Do not allow the user to enter a value of 0 for the denominator of any Fraction; continue to prompt the user for a denominator value until a valid one is entered. The function returns a data-filled Fraction object to the calling function. • A reduceFraction()function that accepts a Fraction object and reduces it to proper form, returning the reduced Fraction. For example, a Fraction entering the function as 0 2/6 would be reduced to 0 1/3, and a Fraction entered as 4 18/4 would be reduced to 8 1/2. • A displayFraction()function that displays any Fraction object passed to it. This function displays a fraction with a slash between the…

Chapter 11 Solutions

Starting Out with C++

Ch. 11.10 - Prob. 11.11CPCh. 11.10 - Write a function that uses a Rectangle structure...Ch. 11.10 - Prob. 11.13CPCh. 11.10 - Prob. 11.14CPCh. 11.10 - Prob. 11.15CPCh. 11.11 - Prob. 11.16CPCh. 11.11 - Prob. 11.17CPCh. 11.11 - Prob. 11.18CPCh. 11.11 - Prob. 11.19CPCh. 11.11 - Prob. 11.20CPCh. 11.12 - Look at the following declaration: enum Flower {...Ch. 11.12 - What will the following code display? enum {...Ch. 11.12 - Prob. 11.23CPCh. 11.12 - What will the following code display? enum Letters...Ch. 11.12 - Prob. 11.25CPCh. 11.12 - Prob. 11.26CPCh. 11 - Prob. 1RQECh. 11 - Prob. 2RQECh. 11 - Prob. 3RQECh. 11 - Look at the following structure declaration:...Ch. 11 - Look at the following structure declaration:...Ch. 11 - Look at the following code: struct PartData {...Ch. 11 - Look at the following code: struct Town { string...Ch. 11 - Look at the following code: structure Rectangle {...Ch. 11 - Prob. 9RQECh. 11 - Prob. 10RQECh. 11 - Prob. 11RQECh. 11 - Look at the following declaration: enum Person {...Ch. 11 - Prob. 13RQECh. 11 - The ______ is the name of the structure type.Ch. 11 - The variables declared inside a structure...Ch. 11 - A(n) ________ is required after the closing brace...Ch. 11 - In the definition of a structure variable, the...Ch. 11 - Prob. 18RQECh. 11 - Prob. 19RQECh. 11 - Prob. 20RQECh. 11 - Prob. 21RQECh. 11 - Prob. 22RQECh. 11 - Declare a structure named TempScale, with the...Ch. 11 - Write statements that will store the following...Ch. 11 - Write a function called showReading. It should...Ch. 11 - Write a function called findReading. It should use...Ch. 11 - Write a function called getReading, which returns...Ch. 11 - Prob. 28RQECh. 11 - Prob. 29RQECh. 11 - Prob. 30RQECh. 11 - Prob. 31RQECh. 11 - Prob. 32RQECh. 11 - Prob. 33RQECh. 11 - Look at the following statement: enum Color { RED,...Ch. 11 - A per store sells dogs, cats, birds, and hamsters....Ch. 11 - T F A semicolon is required after the closing...Ch. 11 - T F A structure declaration does not define a...Ch. 11 - T F The contents of a structure variable can be...Ch. 11 - T F Structure variables may not be initialized.Ch. 11 - Prob. 40RQECh. 11 - Prob. 41RQECh. 11 - T F The following expression refers to element 5...Ch. 11 - T F An array of structures may be initialized.Ch. 11 - Prob. 44RQECh. 11 - T F A structure member variable may be passed to a...Ch. 11 - T F An entire structure may not be passed to a...Ch. 11 - T F A function may return a structure.Ch. 11 - T F when a function returns a structure, it is...Ch. 11 - T F The indirection operator has higher precedence...Ch. 11 - Prob. 50RQECh. 11 - Prob. 51RQECh. 11 - Prob. 52RQECh. 11 - Prob. 53RQECh. 11 - Prob. 54RQECh. 11 - Prob. 55RQECh. 11 - Prob. 56RQECh. 11 - Find the Errors Each of the following...Ch. 11 - Prob. 58RQECh. 11 - struct TwoVals { int a, b; }; int main () {...Ch. 11 - #include iostream using namespace std; struct...Ch. 11 - #include iostream #include string using namespace...Ch. 11 - struct FourVals { int a, b, c, d; }; int main () {...Ch. 11 - Prob. 63RQECh. 11 - Prob. 64RQECh. 11 - Prob. 65RQECh. 11 - struct ThreeVals { int a, b, c; }; int main () {...Ch. 11 - Prob. 67RQECh. 11 - Prob. 1PCCh. 11 - Movie Profit Modify the program written for...Ch. 11 - Prob. 3PCCh. 11 - Weather Statistics Write a program that uses a...Ch. 11 - Weather Statistics Modification Modify the program...Ch. 11 - Soccer Scores Write a program that stores the...Ch. 11 - Customer Accounts Write a program that uses a...Ch. 11 - Search Function for Customer Accounts Program Add...Ch. 11 - Speakers Bureau Write a program that keeps track...Ch. 11 - Prob. 10PCCh. 11 - Prob. 11PCCh. 11 - Course Grade Write a program that uses a structure...Ch. 11 - Drink Machine Simulator Write a program that...Ch. 11 - Inventory Bins Write a program that simulates...Ch. 11 - Prob. 15PC
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT