e. Amy Amy < Bob f. -12 ** 9. a. ?%!! b. a b c d ## c. Flying Coding 11. The of done is: 0 13. Omit the semicolon after The correct statement is: else. if (score >= 60) cout << "You pass." << endl; else cout << "You fail." << endl; 15. The correct code is: if (numOfItemsBought > 10) shippingCharges = 0.0; else if (5 <= numOfItemsBought && numOfItemsBought <= 10) shippingCharges = 3.00 * numOfItemsBought; else if (0 < numOfItemsBought && numOfItemsBought < 5) shippingCharges = 7.00 * numOfItemsBought; 17. 1 18 19. if (sale > = 0.10 else if (sale > 10000 && sale <= 20000) bonus = 0.05; else bonus = 0.0; 21. a. The output is: The semicolon at the end of the statement terminates the Discount = 10%. if if statement. So the statement is not part of the statement. The statement will execute cout if cout regardless of whether the expression in the statement evaluates to or if true false. b. The output is: The semicolon at the end of the statement terminates the Discount = 10%. if if statement. So the statement is not part of the statement. The statement will execute cout if cout regardless of whether the expression in the statement evaluates to or if true false. 23. a. (x >= y) ? z = x y : z = y x; – – b. (hours >= 40.0) ? wages = 40 * 7.50 + 1.5 * 7.5 * (hours 40) – : = hours * 7.50; c. (score >= 60) ? str = "Pass" : str = "Fail"; a. 25. 40.00 b. 40.00 c. 55.00
e. Amy Amy < Bob f. -12 ** 9. a. ?%!! b. a b c d ## c. Flying Coding 11. The of done is: 0 13. Omit the semicolon after else. The correct statement is: if (score >= 60) cout << "You pass." << endl; else cout << "You fail." << endl; 15. The correct code is: if (numOfItemsBought > 10) shippingCharges = 0.0; else if (5 <= numOfItemsBought && numOfItemsBought <= 10) shippingCharges = 3.00 * numOfItemsBought; else if (0 < numOfItemsBought && numOfItemsBought < 5) shippingCharges = 7.00 * numOfItemsBought; 17. 1 18 19. if (sale > = 0.10 else if (sale > 10000 && sale <= 20000) bonus = 0.05; else bonus = 0.0; 21. a. The output is: Discount = 10%. The semicolon at the end of the if statement terminates the if statement. So the cout statement is not part of the if statement. The cout statement will execute regardless of whether the expression in the if statement evaluates to true or false. b. The output is: Discount = 10%. The semicolon at the end of the if statement terminates the if statement. So the cout statement is not part of the if statement. The cout statement will execute regardless of whether the expression in the if statement evaluates to true or false. 23. a. (x >= y) ? z = x – y : z = y – x; b. (hours >= 40.0) ? wages = 40 * 7.50 + 1.5 * 7.5 * (hours – 40) : = hours * 7.50; c. (score >= 60) ? str = "Pass" : str = "Fail"; 25. a. 40.00 b. 40.00 c. 55.00