/* * * Program prompts you for length and width of a garden plot * and reports the total amount of fencing and the cost of * the fenceing * */ #include #define FENCE_PRICE_PER_FOOT 1.13 /* function prototype */ void calculate_cost_fence ( int l, int w); int main() { int length; int width; printf("############################################################\n"); printf("############################################################"); printf("\nThis program will calculate the amount of fencing \n\tat the cost at $%0.2f per foot\n\tfor a rectangular garden plot.\n", FENCE_PRICE_PER_FOOT); printf("\nEnter the length of your Garden plot in whole feet => "); scanf("%d", &length); printf("\nEnter the width of your Garden plot in whole feet => "); scanf("%d", &width); printf("\n"); calculate_cost_fence ( length, width ); printf("############################################################\n"); printf("############################################################\n"); return 0; } void calculate_cost_fence ( int l, int w ) { int totalFencing = 2 * (l + w ); double cost = (double)totalFencing * FENCE_PRICE_PER_FOOT; printf("\nFor a plot %d in length and %d in width,\n\t You will need %d feet of fencing,\n\t Costing you $%0.2f! \n", l,w,totalFencing, cost); }