At any given time, there can be a different set of animals in the shelter. Therefore, you do NOT know the size of the file. Write a COMPLETE C++ program that will do the following: 1. Open the file and read in the data. 2. Call a value returning function that returns a true if the animal is a dog or false if the animal is anything else. 3. Compute the total number of dogs at the shelter. 4. Compute the amount of dog food needed. 5. Print the output so that it is organized as below. Of course there may be a different number of lines, since this is shown only for the data above, and we don't know how many lines are in the data file. All printing is done in the main function. NAME Туре Weight Fido d 22.5 Rover b 0.5 Purrfect 20.0 Cuddles 15.0 Barkly 65.0 There are 2 dogs in the shelter. The amount of dog food needed is: 4.375 bags.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Needs to be a beginner intro level program c++

At any given time, there can be a different set of animals in the shelter. Therefore, you do NOT know
the size of the file.
Write a COMPLETE C++ program that will do the following:
1. Open the file and read in the data.
2. Call a value returning function that returns a true if the animal is a dog or false if the animal is
anything else.
3. Compute the total number of dogs at the shelter.
4. Compute the amount of dog food needed.
5. Print the output so that it is organized as below. Of course there may be a different number of
lines, since this is shown only for the data above, and we don't know how many lines are in the
data file. All printing is done in the main function.
NAME
Туpе
Weight
Fido
d
22.5
Rover
b
0.5
Purrfect
20.0
Cuddles
15.0
Barkly
d
65.0
There are 2 dogs in the shelter.
The amount of dog food needed is: 4.375 bags.
Transcribed Image Text:At any given time, there can be a different set of animals in the shelter. Therefore, you do NOT know the size of the file. Write a COMPLETE C++ program that will do the following: 1. Open the file and read in the data. 2. Call a value returning function that returns a true if the animal is a dog or false if the animal is anything else. 3. Compute the total number of dogs at the shelter. 4. Compute the amount of dog food needed. 5. Print the output so that it is organized as below. Of course there may be a different number of lines, since this is shown only for the data above, and we don't know how many lines are in the data file. All printing is done in the main function. NAME Туpе Weight Fido d 22.5 Rover b 0.5 Purrfect 20.0 Cuddles 15.0 Barkly d 65.0 There are 2 dogs in the shelter. The amount of dog food needed is: 4.375 bags.
During the pandemic, animal rescue shelters have seen an increased interest in animal adoptions,
particularly dog adoptions. Pandemic Pets Rescue shelters birds, cats, and dogs for adoption. Because
dogs are so popular, they need you to create a C++ program that will help them keep track of the
number dogs, they have in the shelter. Also, since this number is constantly changing (dogs get adopted
and more dogs are sheltered) they need to be able to have 2 weeks worth of dog food at the shelter at
all times. The amount of food a dog eats depends on their weight. An estimate of the number of bags
of dog food needed for two weeks is the average weight of all dogs divided by 10.
number_of_dogfoodbags = avg_dog_weight / 10;
Assume that there is a file on disk named PPets.txt that contains information about the pets available
for adoption. Each line contains the pet's name, a character that indicates whether the animal is a dog,
'd', a bird, 'b', or a cat, 'c', and the animal's weight in pounds (note: animal weights can be a decimal
value). A sample file is below:
Fido d 22.25
Rover b .5
Purrfect c 20
Cuddles c 15
Barkly d 65
At any given time, there can be a different set of animals in the shelter. Therefore, you do NOT know
the size of the file.
Write a COMPLETE C++ program that will do the following:
1. Open the file and read in the data.
Transcribed Image Text:During the pandemic, animal rescue shelters have seen an increased interest in animal adoptions, particularly dog adoptions. Pandemic Pets Rescue shelters birds, cats, and dogs for adoption. Because dogs are so popular, they need you to create a C++ program that will help them keep track of the number dogs, they have in the shelter. Also, since this number is constantly changing (dogs get adopted and more dogs are sheltered) they need to be able to have 2 weeks worth of dog food at the shelter at all times. The amount of food a dog eats depends on their weight. An estimate of the number of bags of dog food needed for two weeks is the average weight of all dogs divided by 10. number_of_dogfoodbags = avg_dog_weight / 10; Assume that there is a file on disk named PPets.txt that contains information about the pets available for adoption. Each line contains the pet's name, a character that indicates whether the animal is a dog, 'd', a bird, 'b', or a cat, 'c', and the animal's weight in pounds (note: animal weights can be a decimal value). A sample file is below: Fido d 22.25 Rover b .5 Purrfect c 20 Cuddles c 15 Barkly d 65 At any given time, there can be a different set of animals in the shelter. Therefore, you do NOT know the size of the file. Write a COMPLETE C++ program that will do the following: 1. Open the file and read in the data.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education