Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Write a C++ program that manages the feeding of chickens. In the main function, you will prompt the user for the following values: The

C++

Write a C++ program that manages the feeding of chickens. In the main function, you will prompt the user for the following values:

The number of chickens on the farm(allow 1 to 10) [INTEGER]

The weight of each chicken in lbs (allow 3 to 20) [FLOAT]

The type of each chicken (1=laying, 2=rooster) The program will compute how many ounces of chicken feed to provide to each chicken per day using this formula:

FoodPerDay = (ChickenWeight/10) * 2.3 IF Laying

FoodPerDay = (ChickenWeight/12) * 2 IF Rooster

User input outside of bounds requires the user to re-enter a value

OUTPUT THE FOLLOWING:

The food needed for each chicken in a day will be listed

The sum total of number of ounces required for all chickens for the day will be printed

The sum total of the total weight of the chickens will be printed

EXAMPLE OUTPUT

How many chickens exist?3

Weight of chicken 0 in lbs:11

Type of chicken 0 (1=layer, 2=rooster):1

Weight of chicken 1 in lbs:11

Type of chicken 1 (1=layer, 2=rooster):2

Weight of chicken 2 in lbs:15

Type of chicken 2 (1=layer, 2=rooster):1

Feed required for each chicken is as follows:

Chicken 0 is a layer and requires 2.53 ounces.

Chicken 1 is a rooster and requires 1.83333 ounces.

Chicken 2 is a layer and requires 3.45 ounces.

The total ounces of food required is 7.81333

The total weight of all of the chickens is 37 lbs!

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

Identify the general types of employment laws in Canada.

Answered: 1 week ago