Answered step by step
Verified Expert Solution
Question
1 Approved Answer
P1. For the code below, determine the output from the code #inc lude using namespace std; int main( ) { int numApples(5), num0ranges(10), numBananas (12)
P1. For the code below, determine the output from the code \#inc lude using namespace std; int main( ) \{ int numApples(5), num0ranges(10), numBananas (12) ; double costPerApple(0.1), costPerorange(0.25), costPerBanana(0.05); bool isAppleRotten(true), isorangeRotten(false), isBananaRotten(false); double myCost(0.); if (isAppleRotten && num0ranges >=10 ) \{ if (! isorangeRotten) myCost += num0ranges costPerorange; else if (! isBananaRotten) myCost += numBananas * costPerBanana; else myCost += costPerApple numApples; \} if (! isBananaRotten) myCost +=( numBananas - 2) costPerBanana; cout "What I have to pay =\( =\$ " \ll \)quot; myCost endl; return 0 \}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started