/* Name:Romal Osmani Stud ID:821-822-566 Folder ID:ROsmani Pro:M. Scragg Assignment: 6 (b) */ #include float cstFlooring(*float, *float, *int); float cstPaint(*float, *float, *float, *int); float cstTrim(*float, *float, *int); int main() { int ROmaterials; float ROlength, ROwidth, ROheight; float ROflooring, ROpaint, ROtrim, ROtotalcost; /* asks user for input and assigns it to the vairable's */ printf("Please enter the length: "); scanf("%f",&ROlength); fflush(stdin); printf("Please enter the width: "); scanf("%f",&ROwidth); fflush(stdin); printf("Please enter the height: "); scanf("%f",&ROheight); fflush(stdin); printf("Please choose the meterial type (1-Economy or 2-Deluxe Materials): "); scanf("%d",&ROmaterials); fflush(stdin); if (ROmaterials ==1 || ROmaterials ==2) { ROflooring = cstFlooring(&ROlength, &ROwidth, &ROmaterials); ROpaint = cstPaint(&ROlength, &ROwidth, &ROheight, &ROmaterials); ROtrim = cstTrim(&ROlength, &ROwidth, &ROmaterials); ROtotalcost = (ROflooring + ROpaint + ROtrim); printf("The length is: %6.2f\t\t\n",ROlength); printf("The width is: %6.2f\t\t\n",ROwidth); printf("The height is: %6.2f\t\t\n",ROheight); printf("The total Flooring cost is: %6.2f\t\n",ROflooring); printf("The total Paint cost is: %6.2f\t\n",ROpaint); printf("The total Trim cost is: %6.2f\t\n",ROtrim); printf("The total job cost is: %6.2f\n",ROtotalcost); } else printf("Error\n"); return 0; } float cstFlooring(float *ROsublength, float *ROsubwidth, int *ROsubmaterials) { float ROflooringtotal, ROarea; ROarea= ROsublength * ROsubwidth; if (ROsubmaterials ==1) { ROflooringtotal= ROarea * 5.0; } else ROflooringtotal= ROarea * 10.0; return ROflooringtotal; } float cstPaint(float *ROsublength, float *ROsubwidth, float *ROsubheight, int *ROsubmaterials) { float ROpaintcost, ROarea; ROarea = 2*((ROsubwidth * ROsubheight)+(ROsublength * ROsubheight)); if (ROsubmaterials ==1) { ROpaintcost = ROarea * 2.0; } else ROpaintcost = ROarea * 4.0; return ROpaintcost; } float cstTrim(float *ROsublength, float *ROsubwidth, int *ROsubmaterials) { float ROtrimtotal, ROperimeter; ROperimeter = 2*(ROsublength + ROsubwidth); if (ROsubmaterials ==1) { ROtrimtotal = ROperimeter* 3.0; } else ROtrimtotal = ROperimeter * 5.0; return ROtrimtotal; }