Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write the program in C language. and also follow the instructions given on the question. there's also a sample run. So follow that please.
please write the program in C language. and also follow the instructions given on the question. there's also a sample run. So follow that please. moreover, you will read the initial dog information from a file (dogfile.txt) to load the array.
CIS 170 Final Review Dog Years While it is common to use the formulate dog years for every 1 human year, 7 his is actually inaccurate because studies show that larger dogs age more quickly and have shorter life spans than smaller dogs Small dogs age 15 years for the first human year 8 years for the second human year 5 years for the third human year 4 years for each human year above 3 Medium dogs age 14 years for the first human year 9 years for the second human year 7 years for the third human year 5 years for each human year above 3 Large dogs age 12 years for the first human year 9 years for the second human year 8 years for the third human year 7 years for each human year above 3 Your job is to write a program that will create an array of structures that will hold dog information for up to 10 different dogs. You will read in the initial dog information from a file to load the array. You will pass the array of structures to a function called calcYears() that will calculate whether the dog is small (20 pounds or less), medium (21 to 50 pounds) or large (greater than 50 pounds) and based on its weight, determine how old the dog is in dog years This information will need to be stored in the structure as well Send the array to a function called displayDogs( which will print out the dog's name, the size of the dog (NOT weight, but Small, or Large) its age in human years and its age in dog years The main() will then ask the user if they wish to add a dog to the array. If yes function called getDogInfo() that will ask the user all of the nformation (dog's name, weight, and age). You may not send the for one dog array nor a structure. You must user pointers to capture all the information Add this user info to your array. When the user is done adding dogs to the array (up to a max of 10), send your array to the calcYears() function. You will then need to calculate the dog years using the calc and display the array with new information added in using the displayDogs() functionStep 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