Organic Farms Organic Farms is a locally owned and operated
Organic Farms
Organic Farms is a locally owned and operated farm selling fresh produce and eggs. Write a program to help calculate an order cost.
1. Organic Farms sells a dozen eggs for $3.50, seedless watermelons for $5, and tomatoes for $1 per pound.
2. Organic Farms gives a 10% discount for students so your program needs a way for them to indicate if the buyer is a student or not.
3. Your program should allow for purchases of any combination of products. Do not allow the program to error out if the user fails to put in a quantity or if they put in something other than a number into one of the fields.
4. Taxes are 10% and are calculated after any discount is applied.
5. When the calculate button is clicked display the pre-discount total, discount amount, post-discount total, taxes, and the grand total owed.
6. Add a comment line to the top of your program that includes your name and the date.
Solution
#include<iostream>
int main()
{/*This program is create by Ank on 25-10-2016 */
floar prediscount_total,postdiscount;
float taxes,grandtotal;
float priceeggs=3.50;
float priceseedless_watermelons=5;
int pricetomato=1;
char buyer;
int m, n,o;
cout<<\"enter the dozens of eggs you want\'\';
cin>>m;
cout<<\"enter the seedless watermelons you want\";
cin>>n;
cout<<\"Enter the pounds of tomatoes you want\";
cin>>o;
prediscount_total= (m*priceeggs + n*priceseedless_watermelons + o*pricetomato);
cout<<\"enter the buyer\";
gets(buyer);
if(strcmp(buyer,student)==0)
{discount= 0.1;
(postdiscount=prediscount_total-discount*prediscount_total);}
else
{discount= 0;
postdiscount= prediscount+total;
}
taxes=0.1;
grandtotal= (postdiscount + 0.1*postdiscount);
calculateButton();
void CalculateButton::OnButton1(void)
{ cout<<\"The PRE-discound total is \"<<prediscount_total;
cout<<\"the discount amount is\"<<discount;
cout<<\"The post discount total is\"<<postdiscount;
cout<<\"tAXES\"<<taxes;
cout<<\"The grand total is\"<<grandtotal;
}
}
{ cou
