To store the created animal object pointers you will use an array of animals (no imports are allowed). This array will n
Posted: Fri May 20, 2022 2:40 pm
This is the header source file for object dog
And this is the Source file for object dog
To store the created animal object pointers you will use an array of animals (no imports are allowed). This array will never exceed an index of 10. Each animal object will contain a owner object, if the owner is set to null the following should be displayed ” hoping for adoption". The user will always have three options, the first is to add a new dog, the second to swap the names and the last option to stop the program. Sometimes two dogs' names get swapped. You will need to implement a function named swapNames that will swap the names by reference. This function will be inside of the main file.
E > > The following is an example of the required program: Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: Jake Please enter the age: 12 Does the dog have an owner: Yes Please enter the owners name: Steve Please enter the address: Brooklyn The list of dogs are as follows: Jake (Owner: Steve) Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: John Please enter the age: 4 Does the dog have an owner: No The list of dogs are as follows: Jake (Owner: Steve), John (Owner: hoping for adoption) Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: Lemon Please enter the age: 9 Does the dog have an owner: Yes Please enter the owners name: Craig Please enter the address: Brooklyn The list of dogs are as follows: Jake (Owner: Steve), John (Owner: hoping for adoption) ,Lemon (Owner: Craig) Enter 1 to add a dog, 2 to swap names or 3 to stop: 2 Enter name of first dog: Jake Enter name of second dog: Lemon The list of dogs are as follows: Lemon (Owner: Steve), John (Owner: hoping for adoption), Jake (Owner: Craig) Enter 1 to add a dog, 2 to swap names or 3 to stop: 3
E > > The following is an example of the required program: Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: Jake Please enter the age: 12 Does the dog have an owner: Yes Please enter the owners name: Steve Please enter the address: Brooklyn The list of dogs are as follows: Jake (Owner: Steve) Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: John Please enter the age: 4 Does the dog have an owner: No The list of dogs are as follows: Jake (Owner: Steve), John (Owner: hoping for adoption) Enter 1 to add a dog, 2 to swap names or 3 to stop: 1 Please enter the name of the dog: Lemon Please enter the age: 9 Does the dog have an owner: Yes Please enter the owners name: Craig Please enter the address: Brooklyn The list of dogs are as follows: Jake (Owner: Steve), John (Owner: hoping for adoption) ,Lemon (Owner: Craig) Enter 1 to add a dog, 2 to swap names or 3 to stop: 2 Enter name of first dog: Jake Enter name of second dog: Lemon The list of dogs are as follows: Lemon (Owner: Steve), John (Owner: hoping for adoption), Jake (Owner: Craig) Enter 1 to add a dog, 2 to swap names or 3 to stop: 3
1 #include "dog.h" 2