Write this program in c Do the following problems For assign

Write this program in c++

Do the following problems. For assignment submission, use the format listed in the syllabus. Ron bought several acres of farm to grow and sell vegetables. Suppose that Ron wants to grow a maximum of two types of vegetables. Write a program that prompts Ron or the user to do the following: Enter the total farm area in acres. The number of vegetables (one or two) that the user wants to grow. If the user wants to grow two types of vegetables, then specify the portion, as a percentage, of the farm land used for each type of vegetable. Enter the seed cost, plantation cost, fertilizing cost, labor cost, for each acre. Enter vegetable selling price per acre. Output the total revenue. Output the profit/loss.

Solution

Following code will give you the required functionality:

//total revenue
#include<iostream>
using namespace std;

int main()
{
double area, seed1, plantation1, fertilizing1, labor1, total1, sp1, total_revenue, profit;
double area1, area2, seed2, plantation2, fertilizing2, labor2, total2, sp2;
int number;
cout<<\"Enter the total area in acres: \";
cin>>area;
cout<<\"Enter the number of vegetables (1 or 2) you want to grow: \";
cin>>number;
if(number == 1)
{
cout<<\"Enter the seed cost, plantation cost, fertilizing cost, and labor cost for each acre, respectively\ \";
cin>>seed1>> plantation1>> fertilizing1>> labor1;

total1 = seed1 + plantation1 + fertilizing1 + labor1;
cout<<\"Enter the selling price of the vegetable per acre: \";
cin>>sp1;

total_revenue = sp1*area;
profit = total_revenue - (total1*area);
}
else if(number == 2)
{
cout<<\"Enter the area in percentage for first type of vegetable: \";
cin>>area1;
cout<<\"Enter the area in percentage for first type of vegetable: \";
cin>>area2;

cout<<\"Enter the seed cost, plantation cost, fertilizing cost, and labor cost for each acre for vegetable1, respectively\ \";
cin>>seed1>> plantation1>> fertilizing1>> labor1;

total1 = seed1 + plantation1 + fertilizing1 + labor1;
cout<<\"Enter the selling price of the vegetable1 per acre: \";
cin>>sp1;

cout<<\"Enter the seed cost, plantation cost, fertilizing cost, and labor cost for each acre for vegetable2, respectively\ \";
cin>>seed2>> plantation2>> fertilizing2>> labor2;

total2 = seed2 + plantation2 + fertilizing2 + labor2;
cout<<\"Enter the selling price of the vegetable per acre: \";
cin>>sp2;

total_revenue = (area* 0.01 * area1 * sp1) + (area* 0.01 * area2 * sp2);
profit = total_revenue - (total1 + total2);
}
else
{
cout<<\"wrong input\";
return 1;
}
cout<<\"Total Revenue (in rupees): \"<<total_revenue<<endl;
cout<<\"Profit/loss (in rupees): \"<<profit<<endl;

return 0;
}//end of main function

Hope it helps. Do comment your feedback.

Write this program in c++ Do the following problems. For assignment submission, use the format listed in the syllabus. Ron bought several acres of farm to grow
Write this program in c++ Do the following problems. For assignment submission, use the format listed in the syllabus. Ron bought several acres of farm to grow

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site