Answered You can hire a professional tutor to get the answer.
Use a structure to represent the Animal o Your code will not compile until you create the members listed above 2. Use an enumeration to represent...
Write a C program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.
please put comment with code! and please do not just copy other solutions.
This assignment is about Structures and Enumerations. Should have (main.c , zoo_food_calculator.c , zoo_food_calculator.h )
you don't need to make exactly same output as sample ouput, but value must same as sample ouput.
given code - zoo_food_calculator.c
#include "zoo_food_calculator.h"
float process_mammal(Animal* animal)
{
//fill
}
float process_amphibian(Animal* animal)
{
//fill
}
float process_reptile(Animal* animal)
{
//fill
}
// helper function to print an animal, use where ever you see fit.
void print_animal(Animal* animal)
{
char buf[4];
switch (animal->type)
{
case mammal:
if (animal->faster_than_human)
strcpy(buf, "yes");
else
strcpy(buf, "no");
printf("mammal, weight: %f, height: %f, age: %d, faster than human: %sn", animal->weight, animal->height, animal->age, buf);
break;
case amphibian:
if (animal->pregnant)
strcpy(buf, "yes");
else
strcpy(buf, "no");
printf("amphibian, weight: %f, length:%f, age: %d, pregnant: %sn", animal->weight, animal->length, animal->age, buf);
break;
case reptile:
printf("reptile, weight: %f, length:%fn", animal->weight, animal->length);
break;
}
}
-------------------------------------------
given code - zoo_food_calculator.h
typedef enum {
// fill in enum
} AnimalTypeEnum;
typedef struct {
// fill in struct
} Animal;
// function declarations (this is just declaring the functions, not implementing them)
float process_mammal(Animal* animal);
float process_amphibian(Animal* animal);
float process_reptile(Animal* animal);
void print_animal(Animal* animal);
------------------------------------------------------------
don't forget main.c and please finish with given code
- Attachment 1
- Attachment 2
- Attachment 3
- Attachment 4