Help with College Programming Assignment

Description:

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 $, no % entered).
2 - Calculate projected range of profit and the average profit for each crop.
3 - Print out the projected range of profit and the average profit for each crop. Crop Minimum Profit Maximum Profit Average Profit
Crop - Minimum Profit - Maximum Profit - Average Profit
Sweet Corn
Wheat
Soybeans
Green beans


4 - Tell Old MacDonald which crop he should plant to maximize his profit.;

im extremely confused and have basically resorted to random guessing in order to figure ouw how to take the numbers provided and allow the user to enter them, which the computer will then use calculate Minimum Profit, Maximum Profit, and Average Profit for the crop. Please help if you can, i know my code is quite messy and confused in nature. Any help would be greatly appreciated! Thank you for your time.



// Suggestions:

// Start by creating a program that handles information for one crop and build from there.
//Code one function at a time and test it.

//Clarification:

//The output displayed on the assignment sheet included borders, your output does not //need to include these, it just needs to be displayed in formatted columns.
//- Dollar amounts should be formatted to 2 decimals places and be displayed with a $.

Assignment #1

#include<iostream>
#include<iomanip>
#include<fstream>
using namespace std;
int main()
{
int numrec; //Given
string cropName[50];
double costperAcre[50],yield[50], dperB[50],dperBINC[50];

ifstream inFile;
ofstream outFile;

inFile.
int cost;
int grossMin;
int grossMax
int netMin;
int netMax;
int netAve;
int yield;

struct Data
{
string Crop;
float Costperacre;
int Yield;
float Profit;
float Pincrease;
};
void insertData(Crop *object, Costperacre, Yield, Profit, Pincrease);
void printData(Crop*object);

int main()
{
Data first, second, third, fourth;

insertData(&first,"Sweet Corn","45.25", 173, 0.54, .047)
insertData(&second,"Wheat","43",200, 0.43, .031)
insertData(&third,"Soybeans","37.50",157,0.58,0.053)
insertData(%fourth,"Green Beens", "40.80", 118, 0.72, 0.027)

cout<<"\nData for the first crop:\n"; //Display data stored for the first crop->printData(&first);
cout<<endl<<endl;
cout<<"\nData for the second crop:\n";//Display data stored for the second crop->printData(&second);
cout<<endl<<endl;

return 0;
}

void insertData(Data *object
return 0:
}

public
void GetData();
{
void Properties();
Private
float Costperacre;
float Yield;
float Profit;
float Pincrease;
float netMin;
float
}

const int Maximum = 1000;
class CropProfit
{
public:
class Crops;
{
private:
string Crop;
float CostperAcre;
int Yield;
float Profit;
float Pincrease;
public:
void setCrop();
void Properties();

int main()
{}
Last edited on
when your first post on this forum is asking for homework help, we know you don't love learning.

Try and use the code tags, bottom right corner of text box, <> picture, people are more inclined to help you if 1. You show your own attempt at coding it and 2. You make it look nice
Topic archived. No new replies allowed.