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...
-
The 20-year A-rated bonds of Polly Cracker Company were initially issued at a 10 percent yield (paid semiannually). After 5 years, the bonds have been upgraded to AA. Such bonds are currently...
-
A nozzle for a supersonic wind tunnel is designed to achieve a Mach number of 3.0, with a velocity of \(2000 \mathrm{~m} / \mathrm{s}\), and a density of \(1.0 \mathrm{~kg} / \mathrm{m}^{3}\) in the...
-
On February 1, 2007 Edwards Corporation purchased a parcel of land as a factory site for $50,000. It demolished an old building on the property, and began construction on a new building that was...
-
The position of a particle moving along the x axis is given in centimeters by x = 9.36 + 1.34 t 3 , where t is in seconds. Calculate (a) the average velocity during the time interval t = 2.00 s to t...
-
Martin Manufacturing is preparing its master budget for the first quarter of the upcoming year. The following data pertain to Martin Manufacturing's operations: Current Assets as of December 31...
-
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.
-
The accounts of Consolidated Can contain the following amounts at December 31, 2012: Required Prepare a multiple-step income statement combined with a reconciliation of retained earnings for the year...
-
What is the PV of 5310 paid in year 9 if the cost of capital is 11.7(Do not round Intermediate calculations. Round your answer to 2 decimal places.) Present value. How should you calculate discus...
-
Compare the advantages and disadvantages of the existing approach with Gabriel's suggestion. Provide examples of other costs that are commonly allocated across multiple departments, plants, or...
-
For a per year additional expenditure, Rainbow can get a "Good As New" service contract that essentially keeps the machine in new condition forever. Net of the cost of the service contract, the...
-
What method of valuing professional or business goodwill looks at the net income of a professional practice or business for one year then subtracts what a reasonable salary would be for someone of...
-
In December 2011 the Consumer Prices Index stood at 121.7 (Base date: 2005). The Average Weekly Earnings index for that month for workers in the Transport and storage sector was 148.7 (base date:...
-
Comfort Wear (CW) is a retail shoe store located in a busy shopping complex in downtown Miami. CW is considering selling a new line of shoes starting next month. It will need to hire two additional...
-
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...
-
A steel cable that weighs 8 lb/ft is used to pull a 500 lb block of concrete from the ground to the top of a 120 ft tall building. Let x be the distance, in feet, from the block to the TOP of the...
-
Three metal fishing weights, each with a mass of 1.00102 g and at a temperature of 100.0C, are placed in 1.00102 g of water at 35.0C. The final temperature of the mixture is 45.0C. What is the...
-
A useful quantitative model for the grinding of lenses with known focal lengths is the lens-makers' equation: nlens environment 1) (1/4-1/2), where f is the focal length of the lens, the two index of...
Study smarter with the SolutionInn App