Calculates the number of dozens and single donuts

Fill in the answers. For the program in question 18, include the source code in your document using a syntax highlighter.

What do the following conditions evaluate to? (true or false)
short int A = 5, B = -8, C = 18, D = 0;

  1. (A > B) 7. (D >= C || A == B)
  2. (B <= 0) 8. ((C + 1) == (D + 19))
  3. (D != 0) 9. (B == 0 || C == 0 || D == 0)
  4. (C = 17) 10. (A == 0 && (B > 1 || C > 1))
  5. (A > B && C > D) 11. (!(A = 5) || !(C = 8))
  6. (C != (B + 28)) 12. (A > (B + C) && A < (D + B))
    What will the following code output?
    Num Code Output
  7. float A = 20.5, B = -20.4;
    if (A > (B + 40))
    cout << "Yes";
    else
    cout << "No";
  8. float Yoga = 2.5;
    Yoga++; Yoga++;
    if (!(Yoga < 5))
    Yoga--;
    else
    Yoga++;
    cout << Yoga;
  9. bool Hungry = true;
    bool Thirsty = false;
    if (Hungry || Thirsty)
    {
    cout << "I'm not happy";
    }
    else
    {
    cout << "I'm very happy";
    }
  10. cout << "1";
    int H = -50;
    if (H < (H + 1))
    cout << "2";
    else
    cout << "3";
  11. short int X = 15, Y = 18;
    if (X > 9 && Y < 18)
    cout << "passion";
    else
    cout << "papaya";
  12. Write a program that prompts the user to enter how many donuts they are going to eat. The program should then output how many dozen and single donuts this is. For example, if the user enters 29, the program will say, "This is 2 dozen plus 5 single donuts."
    Also, have the program output different comments (minimun 6) depending on how many donuts the user enters. The ranges for the comments should be contiguous. Look at the example below, but please use your own original comments and ranges.
    If the user eats this many donuts The program will output this
    0 "On a diet or something?"
    1 - 2 "You don't seem very hungry today"
    3 - 6 "Just an appetizer for you?"
    7 - 9 "What's for dessert…cinnamon rolls?"
    10 - 12 "You're a donut freak!"

12 "Mmmmmmm……donuts!"
For this program only, copy the code into your Word document using a syntax highlighter so the code is presentable.

  Calculates the number of dozens and single donuts Answer Sheet 1. True 2. True 3. False 4. True 5. True 6. True 7. False 8. True 9. False 10. False 11. True 12. False 13. The output will be "Yes" 14. The output will be "3" 15. The output will be "I'm not happy" 16. The output will be "13" 17. The output will be "papaya" Program Source Code: #include using namespace std; int main() { int donuts; cout &lt;&lt; "Enter how many donuts you are going to eat: "; cin &gt;&gt; donuts; int dozens = donuts / 12; int singles = donuts % 12; cout &lt;&lt; "This is " &lt;&lt; dozens &lt;&lt; " dozen plus " &lt;&lt; singles &lt;&lt; " single donuts." &lt;&lt; endl; if (donuts == 0) { cout &lt;&lt; "On a diet or something?"; } else if (donuts &gt;= 1 &amp;&amp; donuts &lt;= 2) { cout &lt;&lt; "You don't seem very hungry today"; } else if (donuts &gt;= 3 &amp;&amp; donuts &lt;= 6) { cout &lt;&lt; "Just an appetizer for you?"; } else if (donuts &gt;= 7 &amp;&amp; donuts &lt;= 9) { cout &lt;&lt; "What's for dessert...cinnamon rolls?"; } else if (donuts &gt;= 10 &amp;&amp; donuts &lt;= 12) { cout &lt;&lt; "You're a donut freak!"; } else { cout &lt;&lt; "Mmmmmmm......donuts!"; } return 0; } Explanation: The program prompts the user to enter the number of donuts they are going to eat. It then calculates the number of dozens and single donuts the input corresponds to and outputs the result accordingly. Additionally, based on the number of donuts entered, the program provides different comments as per the specified ranges.    

Sample Answer