Write the C++ code for the multiple-alternative selection structure shown in Figure 6-35. First, use the longer
Question:
Write the C++ code for the multiple-alternative selection structure shown in Figure 6-35. First, use the longer form of the if statement. Then rewrite the code using the shorter form of the if statement.
Transcribed Image Text:
if (sales <- 0) bonus = o display "The sales must be greater than o." else if (sales <= 1000) bonus = sales * o.15 else if (sales <= 5000) bonus = sales * 0.20 else bonus = sales * 0.25 end if end if end if
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 81% (11 reviews)
Longer form of the if s...View the full answer
Answered By
Muhammad Umair
I have done job as Embedded System Engineer for just four months but after it i have decided to open my own lab and to work on projects that i can launch my own product in market. I work on different softwares like Proteus, Mikroc to program Embedded Systems. My basic work is on Embedded Systems. I have skills in Autocad, Proteus, C++, C programming and i love to share these skills to other to enhance my knowledge too.
3.50+
1+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Write the C++ code that uses the substr function to determine whether the string stored in the rate variable ends with the percent sign. If it does, the code should use the replace function to remove...
-
Write the C++ code for a function that receives an integer followed by a double number from the calling statement. The function should multiply the integer by the double number and then return the...
-
Given the file structure shown in Figure, what problem(s) might you encounter if building KOM weredeleted? BUILDING KOM KOM LDB KOM _CODE ROOM CODE TEACHER LNAME TEACHER FNAME TEACHER NITIAL...
-
A mixture containing KClO3, K2CO3, KHCO3, and KCl was heated, producing CO2, O2, and H2O gases according to the following equations: The KCl does not react under the conditions of the reaction. If...
-
The p.d.f. of a random variable X is f(x) = 1 - x/2 for 0 x 2. Find the probability that the random variable has a value less than one standard deviation below the expectation and less than two...
-
Four identical particles, each having charge +q, are fixed at the corners of a square of side L. A fifth point charge -Q lies a distance z along the line perpendicular to the plane of the square and...
-
On the Internet, locate "Corruption and Related Matters: An Annotated Bibliography" by the Independent Commission Against Corruption, especially the Chapters on White Collar Crime and Workplace...
-
The Electrocomp Corporation manufactures two electrical products: air conditioners and large fans. The assembly process for each is similar in that both require a certain amount of wiring and...
-
No comment. TB MC Qu. 02-180 Wiley Hill opened Hill's Repairs on... Wiley Hill opened Hill's Repairs on March 1 of the current year. During March, the following transactions occurred: 1. Wiley...
-
Karl Pearson, one of the founders of modern statistics, showed that the differential equation Yields (for appropriate values of the constants a, b, c, and d) most of the important distributions of...
-
A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer owes and the amount of money the customer paid. The program should...
-
Using the switch statement, write the C++ code that corresponds to the partial flowchart shown in Figure 6-36. Use a char variable named code and a double variable named rate.
-
Schwartz Corporation repurchased 2,000 shares of its own stock for $35 per share. The stock has a par of $10 per share. A month later Schwartz resold 800 shares of the treasury stock for $40 per...
-
On January 1, 2019, the records of Claireborn Company showed the following accounts and balances in its property, plant, and equipment category: Land - P350,000 Land Improvements - P20,000 Buildings...
-
On January 1, 2024, Pet Friendly Stores adopted the retail inventory method. Inventory transactions at both cost and retail, and cost indexes for 2024 and 2025 are as follows: Beginning inventory...
-
Forest Company has five products in its inventory. Information about ending inventory follows. Cost $ 17 Unit Replacement Product Quantity Unit Cost A 500 $ 15 BCDE B 600 20 16 600 8 7 800 500 22 12...
-
Cigco Co. sells two products, the deluxe model and the standard. The deluxe sells for $40/unit. The standard sells for $20/unit. Sales are projected to be 1,000 units for the deluxe and 3,000 units...
-
The following transactions occurred at Beef Hooked Inc. during its first year of operation: Required a. Issued 100,000 common shares at $5 each; 1,000,000 no par shares are authorized. b. Issued...
-
1. Describe the behavior of f (θ) = sec θ at the zeros of g(θ) = cos θ. Explain. 2. (a) Use a graphing utility to complete the table. (b) Make a...
-
Data on weekday exercise time for 20 females, consistent with summary quantities given in the paper An Ecological Momentary Assessment of the Physical Activity and Sedentary Behaviour Patterns of...
-
In this exercise, you will complete the Property Tax application that you created in Exercise 3 in Chapter 2. a. Use Windows to copy the Tax Solution folder from the VB2017\Chap02 folder to the...
-
Open the Orders Solution.sln file contained in the VB2017\Chap03\Orders Solution folder. The interface provides a button for adding the number ordered to the total ordered, and a button for...
-
Open the Enrolled Solution.sln file contained in the VB2017\Chap03\Enrolled Solution folder. The application provides a text box and a button for updating the total number of enrollees. Code the...
-
Output Price Total Cost 0 $300 $250 1 275 260 2 250 290 3 225 350 4 200 500 5 175 680 Refer to the demand and cost data for a pure monopolist given in the table. An unregulated, nondiscriminating...
-
Date: [Chapter 3: Orthographic Projections] P3-32) Given two complete views, sketch in the missing view. Name: (610)
-
A soccer ball that has a mass of 0.5 kg is rolling east with a velocity of 5 m/s collides with a volleyball that has a mass of 0.4 kg that is rolling west with a velocity of 6.5 m/s. After the...
Study smarter with the SolutionInn App