Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the following variables, translate the conditional statements into one line of code in C++ as shown. if() or while() or for() You do not

Using the following variables, translate the conditional statements into one line of code in C++ as shown.

if() or while() or for()

You do not know the values of these variables. You are not answering the questions, you are asking the questions. Assume 28 days in a month. Like Harvest Moon, but with goats.

int tTonsOfPotatoes = ?;

int tTonsOfRadishes = ?;

int tGoats = ?;

float tCashOnHand = ?;

float tMonthlyPay = ?;

float tSpinachCostPerPound = ?;

int tMonthsUntilRetirement = ?;

a.) If I will be a millionaire when I eventually retire

b.) If I can feed my goats 5 pounds of spinach a day each for a month with money I have now

c.) If I can afford to buy enough spinach right now to feed each of my goats 5 pounds a day each for a month

d.) For loop to do something to each pair of radish and potato tons. (Hint: the middle part of a for can have an &&.)

e.) While I still have money

f.) While I have goats and I have more potatoes than radishes

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago