Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

How does version history act as a control for data files?

Answered: 1 week ago

Question

How many attributes/fields are available in the dataset?

Answered: 1 week ago

Question

Where are most of these attributes located?

Answered: 1 week ago