Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

The following program dialogue should help you figure out what kind of program I am looking for Zoo Food Calculator: whaddya want? [o]Mammal or [1]Amphibian or [2]Reptile: 0 Gimme its weight in lbs: 30.0 Gimme its height in feet: 3.2 Gimme its age: 10 Can it run faster than a human? [1-Yes/2 No]: 2 For this animal, you'1l need 4.26667 lbs of food a week! Try again? [1-Yes/2-No]: 1 Zoo Food Calculator: Whaddya want? [e]Mammal or [1]Amphibian or [2]Reptile: 1 Gimme its weight in lbs: 30.0 Gimme its length in inches: 6.0 Gimme its age: 10 Is it pregnant? [1-Yes/2-No]: 1 For this animal, you'11 need 5.225 lbs of food a week! Try again? [1-Yes/2-No]: 1 Zoo Food Calculator: Whaddya want? []Mammal or [1]Amphibian or [2]Reptile: 2 Gimme its weight in lbs: 30.0 Gimme its length in feet: 3.2 Is it winter? [1-Yes/2-No]: 1 For this animal, you'1l need 2.34 1bs of food a week! Try again? [1-Yes/2-No]: 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

Students also viewed these Databases questions

Question

What does the phrase to buy the market mean?

Answered: 1 week ago