1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
int main()
{
int length, width, numcrowns, total;
char colour, frame;
char crowns;
double totalperim, value;
float colour_frame = 0.10;
float regular_frame = 0.15;
float fancy_frame = 0.25;
float cardboard = 0.02;
float glass_front = 0.07;
float crowns_corner = 0.35;
printf("Please enter the length in inches: ");
scanf("%d", &length);
printf("Please enter the width in inches: ");
scanf("%d", &width);
printf("What kind of frame do you want, regular or fancy? ");
scanf("%s", &frame);
printf("What colour do you want the frame to be? ");
scanf("%s", &colour);
printf("Do you want to add crowns on the corners? [0 = No; 1 = Yes]: ");
scanf("%s", &crowns);
totalperim = length * width;
totalperim *= cardboard + glass_front;
if (strcmp(&frame, "regular"))
{
value=0.15;
}
else
value=0.25;
if (strcmp(&colour, "white"))
{
value+=0.10;
}
if (crowns=='1')
{
printf("Enter Number of crowns: ");
scanf("%d", &numcrowns);
total=numcrowns*0.35;
value+=total;
}
value+=totalperim;
printf("Your Total is %.2f", value);
return 0;
}
|