Ive tried a lot of things and I cant seem to find out why my functions are not being detected? I understand that some of the code may be wrong I just started but I don't get why the functions wont be read to the main? Ive used functions in previous programs but I used integers. Im not sure if its cause im trying to use floats but I just cant get it to work.
#include <stdio.h>
#include <stdlib.h>
float amountoffence(float chain, float link, float width, float length)
{
float howmuchfence;
howmuchfence=length+length+width+width;
return howmuchfence;
}
float costoffence(float link, float post, float gate, float chain, howmuchfence)
{
float fencecost;
link=howmuchfence*chain;
fencecost = link+post+gate;
return fencecost;
}
float amountofgrass(float length, float width)
{
float grass;
grass = length*width;
return grass;
}
float costofgrass(float grass)
{
float grassprice;
grassprice=grass*64.25;
return grassprice;
}
int main()
{
float grass, length, width, height, post, chain, gate, size, link, grassprice, total, gst, totaltax, howmuchfence, costoffence, fencecost, amountoffence, amountofgrass, costofgrass;
printf("Please note that all measurements are in meters \n \n \n");
printf("Please enter the length of the base (Minimum length is 2 and Maximum is 5) \n");
scanf("%f", &length);
printf("Please enter the width of the base (Minimum width is 1 and Maximum is 2) \n");
scanf("%f", &width);
printf("Do you have a large dog or small dog (Type 1 for large or 2 for small)");
scanf("%f", &size);
if(size == 1)
{
chain=8.10;
gate=165;
post=82;
}
else
{
chain=12.45;
gate=148;
post=66;
}
fencecost = costoffence(link, post, gate);
grass = amountofgrass(length, width);
howmuchfence = amountoffence(chain, link, width);
grassprice = costofgrass(grass);
total=fencecost+grassprice;
gst=5;
totaltax=total*(gst/100);
printf("--Customized Dog Run Recipt--\n");
printf("Length of dog run: %0.02f m\n", length);
printf("Width of dog run: %0.02f m\n", width);
printf("Height of dog run: %0.02f m\n", height);
printf("Amount of fence: %0.02f m\n", howmuchfence);
printf("Amount of gates: 1\n");
printf("Cost of fence: $ %0.02f\n", fencecost);
printf("Amount of grass: %0.02f m^2\n", grass);
printf("Cost of grass: $ %0.02f\n", grassprice);
printf("Total cost before GST: $ %0.02f\n", total);
printf("Amount of GST: %0.02f percent \n", gst);
printf("Total cost after GST: $ %0.02f \n", totaltax);
return 0;
}