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 37.50 157 0.68 5.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)
** You need to include 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 4.7

Minimum Profit Maximum Profit Average Profit
Sweet corn $48170.00 $52560.74 $50365.37
Enter the crop name: Wheat
Enter cost, yield, price per bushel, and increase data: 43.00 200 0.43 3.1

Minimum Profit Maximum Profit Average Profit
Wheat $43000.00 $45666.00 $44333.00
Enter the crop name: Soybeans
Enter cost, yield, price per bushel, and increase data: 37.50 157 0.68 5.3

Minimum Profit Maximum Profit Average Profit
Soybeans $69260.00 $74918.28 $72089.14
Enter the crop name: Green beans
Enter cost, yield, price per bushel, and increase data: 40.80 118 0.72 2.7

Minimum Profit Maximum Profit Average Profit
Green beans $44160.00 $46453.92 $45306.96
Old MacDonald, you should plant Soybeans
*/
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.