Question: Define a structure called Kitten which has fields name , weight_lbs , weight_kg , and daily_energy_req . The name is a string and the weight_lbs

Define a structure called Kitten which has fields name, weight_lbs, weight_kg, and daily_energy_req. The name is a string and the weight_lbs, weight_kg, and daily_energy_req are double precision values. Be sure to typedef your struct.

Write a function calc_requirements() that accepts a struct of type Kitten described above as a parameter. This function needs to convert the weight of the kitten in pounds [lbs] to kilograms [kg] (1 kg = 2.2 lbs) and calculate the daily energy requirement of the kitten as daily_energy_req = 100 x weight_kg. The function should then store the daily energy requirement, print the name of the kitten and the daily energy requirement, and return 1 upon successful calculation. If there is not enough information to calculate the daily energy requirement (if the weight in pounds is 0), the function should return 0 and skip calculation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!