Chapter 4: Problem 14
The expression that follows the switch statement must have a(n) ___ value.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.
/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
Learning Materials
Features
Discover
Chapter 4: Problem 14
The expression that follows the switch statement must have a(n) ___ value.
These are the key concepts you need to understand to accurately answer the question.
All the tools & learning materials you need for study success - in one app.
Get started for free
The trailing else in an \(1 \mathrm{f} / \mathrm{e}\) lse if statement has a similar purpose as the _____ section of a switch statement.
Using the following chart, write a \(\mathrm{C}++\) statement that assigns \(.10, .15,\) or .20 to commission \(10 \mathrm{n}\), depending on the value in sales. $$\begin{array}{ll} \text { SALES } & \text { COMMISSION RATE } \\ \hline \text { Up to } \$ 10,000 & 10 \% \\ \$ 10,000 \text { to } \$ 15,000 & 15 \% \\ \text { Over } \$ 15,000 & 20 \% \end{array}$$
Write one or more \(\mathrm{C}++\) statements that assign the correct value to discount, using the logic described here: Assign .20 to discount if dept equals 5 and price is \(\$ 100\) or more. Assign .15 to discount if dept is anything clse and price is \(\$ 100\) or more. Assign.10 to discount if dept cquals 5 and price is less than \(\$ 100\). Assign .05 to discount if dept is anything else and price is less than \(\$ 100\).
An expression using the greater-than, less-than, greater-than-or-equal-to, less-than-or. equal-to, equal, or not-equal operator is called a(n)_____ expression.
Convert the following if/else if statement into a switch statement: if (choice == 1) { cout << fixed << showpoint << setprecision(2); } else if ((choice == 2) || (choice == 3)) { cout << fixed << showpoint << setprecision(4); } else if (choice == 4) { cout << fixed << showpoint << setprecision(6); } else { cout << fixed << showpoint << setprecision(8); }
What do you think about this solution?
We value your feedback to improve our textbook solutions.