1. Write suitable if statements for the following conditions: a. If an angle is equal to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write suitable if statements for the following conditions: a. If an angle is equal to 90 degrees, print the message "The angle is a right angle."; else, print the message "The angle is not a right angle." b. If the temperature is above 100 degrees, display the message "above the boiling point of water"; else, display the message "below the boiling point of water." c. If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. d. If the slope is less than 0.5, set the variable flag to 0; else, set flag to 1. 2. Rewrite the following if-else chain by using a switch statement: if (letterGrade == 'A') cout < < "The numerical grade is between 90 and 100"; else if (letterGrade== 'B') cout < < "The numerical grade is between 80 and 89.9"; else if (letterGrade 'C') cout < < "The numerical grade is between 70 and 79.9"; else if (letterGrade == 'D') cout < < "How are you going to explain this one?"; else { } cout < < "Of course I had nothing to do with my grade."; cout < < "It must have been the professor's fault."; 1. Write suitable if statements for the following conditions: a. If an angle is equal to 90 degrees, print the message "The angle is a right angle."; else, print the message "The angle is not a right angle." b. If the temperature is above 100 degrees, display the message "above the boiling point of water"; else, display the message "below the boiling point of water." c. If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. d. If the slope is less than 0.5, set the variable flag to 0; else, set flag to 1. 2. Rewrite the following if-else chain by using a switch statement: if (letterGrade == 'A') cout < < "The numerical grade is between 90 and 100"; else if (letterGrade== 'B') cout < < "The numerical grade is between 80 and 89.9"; else if (letterGrade 'C') cout < < "The numerical grade is between 70 and 79.9"; else if (letterGrade == 'D') cout < < "How are you going to explain this one?"; else { } cout < < "Of course I had nothing to do with my grade."; cout < < "It must have been the professor's fault.";
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Calculate the p value for the following conditions and determine whether to reject the null hypothesis: a. One tail test, z x = 1.50, and = 0.05 b. One tail test, z x = 2.25, and = 0.02 c. Two tail...
-
Calculate the p value for the following conditions and determine whether to reject the null hypothesis: a. One tail test, z x = 1.46, and = 0.10 b. One tail test, z x = 2.48, and = 0.01 c. Two tail...
-
Calculate the p value for the following conditions and determine whether to reject the null hypothesis: a. One tail (lower) test, z p = 1.36, and = 0.05 b. One tail (upper) test, z p = 1.28, and =...
-
Examine your own organisation, or one that you know. What forms of pre-departure training does it offer?
-
Summit Financial buys and sells securities, expecting to earn profits on short-term differences in price. On December 28, Summit purchased Microsoft common shares for $485,000. On December 31, the...
-
In what situations might judgmental or experiential forecasting be appropriate?
-
For Problem 6.8, (a) Fit the corresponding negative binomial model with the same linear predictor. (b) Compare the analysis between part (a) and that from Problem 6.8. 6.8 For the Sexual Health pilot...
-
Wal-Mart Stores (Walmart) is the worlds largest retailer. It employs an everyday low price strategy and operates stores as three business segments: Wal-Mart Stores U.S., International, and Sams Club....
-
1) John was in Miami, he visited his investment house and invested a total of US$12,000, a fraction at 4% and the remainder at 6%. His total annual return would be $620. How much did he invest at...
-
Peanut Company acquired 90 percent of Snoopy Company's outstanding common stock for $270,000 on January 1, 20X8, when the book value of Snoopy's net assets was equal to $300,000. Problem 3-34...
-
Create files in Notepad containing three integers separated by some whitespace. Save them in your home directory as "nums2.txt", "nums3.txt", "nums4.txt", etc. Then write a program that asks the user...
-
Which statement is the most accurate? a) Most Americans are underemployed. b) Employment discrimination causes underemployment of labor. c) It is impossible for an economy to operate outside its...
-
Human wants are relatively ________, while economic resources are relatively ____________.
-
Our economy does a very good job with respect to ________. a) both equity and efficiency b) equity, but not efficiency c) efficiency, but not equity d) neither equity nor efficiency.
-
Adam Smith believed people are guided by all of the following except ______. a) the profit motive b) self-interest c) the public good d) the invisible hand
-
Which does not fit with the others? a) competition b) government planning and regulation c) the invisible hand d) the price mechanism.
-
How can people collectively help to improve the nature and implementation of Environmental laws?
-
What is an insurable interest? Why is it important?
-
Consider the following set of ordered pairs: Assuming that the regression equation is y = 3.693 + 0.285x and that the SSE = 7.650, test to determine if the slope is not equal to zero using = 0.10. x...
-
A process produces strings of Christmas tree lights that historically have experienced a defective rate of 4%. A customer has placed an order for 150 strings of lights. Use the normal approximation...
-
The on time performances of flights in the airline industry are an important measurement that can help attract customers. The following data show the number of late flights from random samples taken...
-
How many structural isomers are there for hydrocarbons that have the molecular formula C 4 H 10 ? (a) none (b) one (c) two (d) three
-
Which contains more hydrogen atomsa five-carbon saturated hydrocarbon molecule or a five-carbon unsaturated hydrocarbon molecule? (a) The unsaturated hydrocarbon has more hydrogen atoms. (b) The...
-
Explain why caprylic acid, CH 3 (CH 2 ) 6 COOH, dissolves in a 5, aqueous solution of sodium hydroxide but caprylaldehyde, CH 3 (CH 2 ) 6 CHO, does not dissolve. (a) With two oxygens, the caprylic...
Study smarter with the SolutionInn App