/* Filename: try2.cpp Author: Br. David Carlson Date: July 5, 1998 Revised: July 17, 2000 to use modern headers. This test program creates a few objects of type Product and prints their contents on the screen. It also changes the price of one product, showing the results on the screen. The Product class's "get" functions are used to extract the values of the three fields of one of the objects, with the results printed on the screen. */ #include "product2.h" int main(void) { ShortString Result; Product ProductA("toaster, 4 slice", 1997, 91.98); Product ProductB; // use default values Product ProductC("mixer, 5 speed", 1998, 32.95); cout << "ProductA:" << endl; ProductA.Print(); cout << "ProductB:" << endl; ProductB.Print(); cout << "ProductC:" << endl; ProductC.Print(); cout << "Press ENTER to go on" << endl; cin.get(); ProductA.ChangePrice(87.95); cout << "After changing the price on ProductA we have:" << endl; ProductA.Print(); // Let's get the values of the three fields individually: ProductA.GetName(Result); cout << "Name of ProductA: " << Result << endl; cout << "Year made for ProductA: " << ProductA.GetYear() << endl; cout << "Price of ProductA: " << ProductA.GetPrice() << endl << endl; return 0; }