Thursday, March 22, 2012

Here's an edit to the cafe cost program.  Now includes labor, and gives cost per day/milk,espresso,and coffee needed based on a loop.

/*costs program by B0N354W*/

#include <stdio.h>

#define BAGCOST 65.0
#define BAGSHOTS 250.0
#define MILKCOST 4.09
#define MILKOZ 128.0
#define SMALL 12.0
#define MEDIUM 16.0
#define LARGE 20.0
#define SCOFPB 150.0
#define MCOFPB 112.5
#define LCOFPB 90.0
#define LABOR 0.15
#define STARTUP 28280.0
#define MARKUP 2

int main()
{
    float shotcost,slatte_pg,mlatte_pg,llatte_pg,slatte_mp,mlatte_mp,llatte_mp,slattecost,mlattecost,llattecost,scoffeecost,mcoffeecost,lcoffeecost,daycost,espressobags,coffeebags,gallons,profit;
    int lattepd,coffeepd,days,x,startup;
    float daycosts[19];

    shotcost=BAGCOST/BAGSHOTS;
    slatte_pg=MILKOZ/(SMALL-1);
    mlatte_pg=MILKOZ/(MEDIUM-2);
    llatte_pg=MILKOZ/(LARGE-3);
    slatte_mp=MILKCOST/slatte_pg;
    mlatte_mp=MILKCOST/mlatte_pg;
    llatte_mp=MILKCOST/llatte_pg;
    slattecost=slatte_mp+shotcost+0.05+LABOR;
    mlattecost=mlatte_mp+shotcost*2+0.06+LABOR;
    llattecost=llatte_mp+shotcost*3+0.07+LABOR;
    scoffeecost=BAGCOST/SCOFPB+0.05+LABOR;
    mcoffeecost=BAGCOST/MCOFPB+0.06+LABOR;
    lcoffeecost=BAGCOST/LCOFPB+0.07+LABOR;

/*cost per individual item*/  
    printf("\nINDIVIDUAL ITEM COSTS\n\n");
    printf("espresso shot: %.2f\n\n",shotcost);
    printf("small latte:%.2f\nmedium latte:%.2f\nlarge latte:%.2f\n\n",slattecost,mlattecost,llattecost);
    printf("small coffee:%.2f\nmedium coffee:%.2f\nlarge coffee:%.2f\n\n",scoffeecost,mcoffeecost,lcoffeecost);
    printf("With 300 percent markup\n");
    printf("small latte:%.2f\nmedium latte:%.2f\nlarge latte:%.2f\n\n",slattecost*3,mlattecost*3,llattecost*3);
    printf("small coffee:%.2f\nmedium coffee:%.2f\nlarge coffee:%.2f\n\n\n",scoffeecost*3,mcoffeecost*3,lcoffeecost*3);

/*cost per day*/
    getchar();
    printf("DAY COST ESTIMATES\n\n");
    lattepd=0;
    x=0;
    for(coffeepd=20;coffeepd<=400;coffeepd+=20)
    {   
         lattepd+=20;
         printf("lattes per day: %d\n",lattepd);
         printf("coffees per day: %d\n",coffeepd);
         daycost=(((scoffeecost+mcoffeecost+lcoffeecost)/3)*coffeepd)+(((slattecost+mlattecost+llattecost)/3)*lattepd);
         printf("COST PER DAY: %.2f\n\n",daycost);
         daycosts[x]=daycost;
         gallons=lattepd/((slatte_pg+mlatte_pg+llatte_pg)/3);
         printf("%.2f gallons of milk needed\n",gallons);
         espressobags=(lattepd*2)/BAGSHOTS;
         printf("%.2f 5lb bags of espresso needed\n",espressobags);
         coffeebags=coffeepd/((SCOFPB+MCOFPB+LCOFPB)/3);
         printf("%.2f 5lb bags of regular coffee needed\n",coffeebags);
         x+=1;
         printf("-------------------------------\n\n");
    }

/*determining time till profitability*/
    getchar();
    printf("Days till profitability at different costs per day and 300 percent markup\n");
    for(x=0;x<=19;x++)
    {
         printf("for cost per day $%.2f: ",daycosts[x]);
         profit=daycosts[x]*2;
         startup=STARTUP;
         days=0;
         while(startup>=0)
         {
               startup-=profit;
               days+=1;
         }
         printf("%d days\n",days);
    }
    return(0);
}