Question: Write a c++ program. Old MacDonald has a farm and not only does he have animals, he also has 1000 acres on which to grow
Write a c++ program.
Old MacDonald has a farm and not only does he have animals, he also has 1000 acres on which to grow his crops. The problem is that it is becoming more difficult to decide which crop is most profitable so he needs some help. Given the data below, write a program that will help Old MacDonald decide which crop is the most profitable to grow.
| Crop | Cost per acre | Yield (bushel/acre) | $/bushel | $/bushel (increase) |
| Sweet corn | 45.25 | 173 | 0.54 | 4.7% |
| Wheat | 43.00 | 200 | 0.43 | 3.1% |
| Soybeans | 43.50 | 157 | 0.61 | 4.3% |
| Green beans | 40.80 | 118 | 0.72 | 2.7% |
Program requirements:
1 - Allow all the data from the table to be entered by a user (no % entered for increase)
2 - Calculate projected range of net profit and the average net profit for each crop.
Minimum Gross Profit(MnGP) = (yield * $/bushel * acres)
Maximum Gross Profit = MnGP + (MnGP * (increase/100))
You need to subtract the cost of growing the crop to get the net profit range
3 - Print out the minimum net profit, maximum net profit and the average net profit for each crop.
4 - Tell Old MacDonald which crop he should plant to maximize his profit.
- the crop with the best average profit.
/* Results of the program
Enter the crop name: Sweet corn
Enter cost, yield, price per bushel, and increase data: 45.25 173 0.54 2.7
Enter the crop name: Wheat
Enter cost, yield, price per bushel, and increase data: 43.00 200 0.43 3.1
Enter the crop name: Soybeans
Enter cost, yield, price per bushel, and increase data: 43.50 157 0.61 4.3
Enter the crop name: Green beans
Enter cost, yield, price per bushel, and increase data: 40.80 118 0.72 2.7
Crop Minimum Profit Maximum Profit Average Profit
Sweet corn $48170.01 $52560.75 $50365.38
Wheat $43000.00 $45666.00 $44333.00
Soybeans $52270.01 $56388.12 $54329.06
Green beans $44160.01 $46453.93 $45306.97
Old MacDonald, you should plant Soybeans
*/
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
