/** * Aquarium Lab Series * Copyright (C) 2000 Alyce Brady * * This is the text-based implementation of the Display class. * * Author: Alyce Brady * * Created: 7/1/99 * Modified 2/6/2000 Added the ShowAquarium function. * * Acknowledgements: * This class is part of the Aquarium Lab Series, which was inspired * by the AP Marine Biology Case Study found at * http://www.collegeboard.org/ap/computer-science/marine_biology/ * This Display class is NOT the same as the Display class in Part II * of the Case Study, but is loosely based on that class. * * License: * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include #include "display.h" #include "aquarium.h" #include "aquafish.h" // constructor Display::Display(Aquarium a) : theAquarium (a) // postcondition: ready to display an Aquarium or AquaFish // (text-based display) { } // modifier functions (modifiers because they change the state of the output) void Display::ShowAquarium() // postcondition: aquarium displayed textually { cout << "Dimensions of aquarium are " << theAquarium.Width() << "x" << theAquarium.Height() << "." << endl; } void Display::Show(AquaFish f) // postcondition: state of f written as text to cout { cout << f.ToString() << endl; } void Display::Show(apvector school) // postcondition: all fish in school written as text to cout { for ( int i = 0; i < school.length(); i++ ) { Show (school[i]); } }