CSE 143, Summer 2000 Quiz 1 (with sample solutions) ///////////////////////// SOLUTION //////////////////////////////// //// CSE143 Quiz, 6/29/00 ////////////////////////////////////////// #include //class declaration here (if any) class InventoryData { public: InventoryData(char []); double getPrice(char []); int getHowMany(char []); // no additional methods are needed // nothing is needed for private data (for this quiz) }; // non-class function prototypes here (if any) double totalvalue(double, int, char); // This is NOT a method void main() { //local variables here (if any) double price; int quantity; ofstream oFile("c:\\inventoryreport.txt"); // exact filename doesn't matter InventoryData myInventory("c:\\factorydata.txt"); // T/F 1.This implies there is a class called myInventory. FALSE price = myInventory.getPrice("umbrellas"); // T/F 2.From this we can deduce that the class has at least one public method. TRUE quantity = myInventory.getHowMany("umbrellas"); // T/F 3. quantity must be the name of a member variable of a class. FALSE oFile << "value is " << totalvalue(price, quantity, 'A'); // T/F 4.oFile, like cout, is a reserved word in C++. FALSE // T/F 5.This line illustrates a use of the "extraction" operator. FALSE // T/F 6.totalvalue here is a method of a class. FALSE oFile.close(); // T/F 7. Closing an output file is not required by C++, but not doing so // may result in data being lost. TRUE }