// Oldham, Jeffrey D. // 2000Feb07 // CS1321 // // Modified by: // Massingill, Berna L. // 2001Feb?? // Example Use of the Shopping Cart Class #include #include // has EXIT_SUCCESS #include #include "shoppingCart.h" int main() { // Create the shopping cart (not specifying a name). shoppingCart sc; // To create a shopping cart and give your name: // shoppingCart sc("Jeffrey D. Oldham"); const double budget = 250.00; // how much we can spend // Add items to the shopping cart. sc.insert("Pepsi", 2.99); sc.insert("Pepsi", 2.99); sc.insert("Pepsi", 2.99); sc.insert("tires", 129.99); // Print what is in the shopping cart. cout << "So far our shopping cart has:\n" << sc << endl; // ADDED // Keep shopping if we have not exceeded our budget. if (sc.totalSoFar() < budget) { sc.insert("windshield", 185.00); sc.insert("Age of Empires II", 44.99); } // Obtain the 10% discount for Trinity students. sc *= (1-0.10); // Buy the items, specifying a credit card number and where to print // the receipt. sc.checkout("1234 5678 8765 4321"); // Shopping cart automatically destroyed. return EXIT_SUCCESS; }