Question
Background: The purpose of this assignment is to get practice working with functions. Functions are the backbone of C programs . We need to get
Background:
The purpose of this assignment is to get practice working with functions. Functions are the backbone of C programs. We need to get very comfortable with how to define and call functions. Functions are a problem-solving strategy. Functions break a large, complex problem into smaller, more manageable pieces. As shown in the Savitch, declare your function (its name, what it returns, its parameters) before you try calling it. Many of the upcoming homework assignments will be dealing with functions.
Project 5: Zoo Food Calculator
The purpose of this program is to determine the amount of food eaten by a certain kind of animal. Rather than using one big pile of main( ), you need to use functions for these calculations. In addition, you need to include various int or double const declarations within your program. Finally, embed your program in a loop so that the calculation can be repeated as often as the user wishes.
IN ORDER TO RECEIVE FULL CREDIT, YOU MUST DEFINE AND CALL FUNCTIONS AND PASS ARGUMENTS.
You should base your calculations on the following table:
Mammals | Amphibians | Reptiles | ||
1 lb for each 10 lbs in weight | 2/3 lb for each 5 lbs in weight | 1/5 lb for each 6 lbs in weight | ||
1/3 lb for each foot in height | 1/4 lb for each 6 inches in length | 1/2 lb for each foot in length | ||
1/10 lb for each 5 years of age | 1/5 lb for each 4 years in age | Deduct 10% of food during winter | ||
Add an extra 15% of food if the animal can run faster than a human | Add an extra 10% of food if the animal is pregnant |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started