#include #include #include // Customer class declaration // precondition: srand() must be called once before any function methods // postcondition: arrive(void) returns a random integer between 1 and 15 // : gallons(void) returns a random integer between 3 and 20 #include class Customer { public: Customer(void) {cout << "\n*** A new customer has been created ***" << endl;}; ~Customer(void) {cout << "!!!! This customer object has been deleted !!!!" << endl;}; int arrive(void) {return(1 + rand() % 16);}; int gallons(void) {return(3 + rand() % 21);}; }; int main() { Customer *anotherCust; // declare 1 pointer to an object of type Customer int i, howMany; int interval, request; cout << "Enter the number of customers to be created: "; cin >> howMany; srand(time(NULL)); for(i = 1; i <= howMany; i++) { // create a new object of type Customer anotherCust = new Customer; // use the pointer to access the member functions interval = anotherCust->arrive(); request = anotherCust->gallons(); cout << "The arrival interval is " << interval << " minutes" << endl; cout << "The new customer requests " << request << " gallons" << endl; cout << "The memory address of this object is: "<< anotherCust << endl; // delete the created object // delete anotherCust; } return 0; }