Question
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
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