Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this computer science program! It should be written in C++, I have attached the contents of the driver.cpp file below as well

Need help with this computer science program! It should be written in C++, I have attached the contents of the driver.cpp file below as well as a sample output for the program, thanks for your time and as always I will leave a thumbs up!

This is the driver.cpp file contents

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

#include #include "dog.h" #include "dogmanager.h" 9 19 11 using namespace std; 12 13 const int NUM_ARGS = 2; 14 15 16 17 18 19 int main(int argc, char const #argv[]) { if (argc dogList; // holds dogs loaded from file Functions The following are the required functions for the class. You may add other private functions as needed. The public interface should not change. Getters and Setters This is a case where you do not create getters and setters. The dogList should only be manipulated internally. The class can optionally pass it to other classes as needed (in this case, the DogTablePrinter class). Function: DogManager dm(string filename) (parameterized constructor) Input: the name of the file containing the dog information Output: instance of DogManager class This constructor should call the private function loadDogs (see below). Function: loadDogs (string filename) Access level: public Input: the name of the file containing the dog information Returns: instance of DogManager class The pseudo-code below shows the expected flow for this function: open file for each line in the file read the line create a dog object and add it to the vector of dog objects Exceptions: This function must throw an exception if the file supplied cannot be opened. The message should read "File could not be opened", where is the name of the file that was supplied on the command line. Technical requirements: This function populates the private attribute vector dogList Function oldestDog() Access level: public Input: None Returns: the Dog object that has the highest age of those currently loaded Function printDogTable() Access level: public Input: None Returns: None Output: Prints a table to the console. This function delegates printing to the DogTablePrinter class by calling printDogTable . See the class description below. Class: DogTablePrinter Files dogtableprinter.h, dogtableprinter.cpp Overview This class encapsulates the printing of the table. Note that this class has no attributes, so that it could be designed to have only static functions. This will be discussed later in the semester. Attributes See above. Functions Only one public function is required. You may use private functions as needed. Function printDogTable) Access level: public Input: vector containing all the dogs that have been loaded in the system Return: none Output: prints table of dogs. See the example output above for the required output format Class: Dog Files dog.h , dog.cpp Overview These files should implement the Dog class. The class is responsible for holding all attributes of a dog. The implementation of functions for the class must be in the cpp file, not the h file. Attributes The following are the required private attributes of the Dog class: Attributes The following are the required private attributes of the Dog class: string name; // name of the dog int age; // its age in years string breed; // the dog breed (Terrier, Bloodhound, etc. Functions The following are the required functions for the class. You may add other private functions as needed. The public interface should not change. Getters and Setters Create getters and setters for all class attributes. Function Dog(string name, int age, string breed) Access level: public Input: dog name, age, and breed Return: instance of Dog object (this is constructor, so no explicit return!) #include #include "dog.h" #include "dogmanager.h" 9 19 11 using namespace std; 12 13 const int NUM_ARGS = 2; 14 15 16 17 18 19 int main(int argc, char const #argv[]) { if (argc dogList; // holds dogs loaded from file Functions The following are the required functions for the class. You may add other private functions as needed. The public interface should not change. Getters and Setters This is a case where you do not create getters and setters. The dogList should only be manipulated internally. The class can optionally pass it to other classes as needed (in this case, the DogTablePrinter class). Function: DogManager dm(string filename) (parameterized constructor) Input: the name of the file containing the dog information Output: instance of DogManager class This constructor should call the private function loadDogs (see below). Function: loadDogs (string filename) Access level: public Input: the name of the file containing the dog information Returns: instance of DogManager class The pseudo-code below shows the expected flow for this function: open file for each line in the file read the line create a dog object and add it to the vector of dog objects Exceptions: This function must throw an exception if the file supplied cannot be opened. The message should read "File could not be opened", where is the name of the file that was supplied on the command line. Technical requirements: This function populates the private attribute vector dogList Function oldestDog() Access level: public Input: None Returns: the Dog object that has the highest age of those currently loaded Function printDogTable() Access level: public Input: None Returns: None Output: Prints a table to the console. This function delegates printing to the DogTablePrinter class by calling printDogTable . See the class description below. Class: DogTablePrinter Files dogtableprinter.h, dogtableprinter.cpp Overview This class encapsulates the printing of the table. Note that this class has no attributes, so that it could be designed to have only static functions. This will be discussed later in the semester. Attributes See above. Functions Only one public function is required. You may use private functions as needed. Function printDogTable) Access level: public Input: vector containing all the dogs that have been loaded in the system Return: none Output: prints table of dogs. See the example output above for the required output format Class: Dog Files dog.h , dog.cpp Overview These files should implement the Dog class. The class is responsible for holding all attributes of a dog. The implementation of functions for the class must be in the cpp file, not the h file. Attributes The following are the required private attributes of the Dog class: Attributes The following are the required private attributes of the Dog class: string name; // name of the dog int age; // its age in years string breed; // the dog breed (Terrier, Bloodhound, etc. Functions The following are the required functions for the class. You may add other private functions as needed. The public interface should not change. Getters and Setters Create getters and setters for all class attributes. Function Dog(string name, int age, string breed) Access level: public Input: dog name, age, and breed Return: instance of Dog object (this is constructor, so no explicit return!)

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

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions