//DISPLAY 5.11 Program with a Stub //Determines the retail price of an item according to //the pricing policies of the Quick-Shop supermarket chain. #include void introduction( ); //Postcondition: Description of program is written on the screen. void getInput(double& cost, int& turnover); //Precondition: User is ready to enter values correctly. //Postcondition: The value of cost has been set to the //wholesale cost of one item. The value of turnover has been //set to the expected number of days until the item is sold. double price(double cost, int turnover); //Precondition: cost is the wholesale cost of one item. //turnover is the expected number of days until sale of the item. //Returns the retail price of the item. void giveOutput(double cost, int turnover, double price); //Precondition: cost is the wholesale cost of one item; turnover is the //expected time until sale of the item; price is the retail price of the item. //Postcondition: The values of cost, turnover, and price have been //written to the screen. int main( ) { double wholesaleCost, retailPrice; int shelfTime; introduction( ); getInput(wholesaleCost, shelfTime); retailPrice = price(wholesaleCost, shelfTime); giveOutput(wholesaleCost, shelfTime, retailPrice); return 0; } //Uses iostream: void introduction( ) { using namespace std; cout << "This program determines the retail price for\n" << "an item at a Quick-Shop supermarket store.\n"; } //Uses iostream: void getInput(double& cost, int& turnover) { using namespace std; cout << "Enter the wholesale cost of item: $"; cin >> cost; cout << "Enter the expected number of days until sold: "; cin >> turnover; } //Uses iostream: void giveOutput(double cost, int turnover, double price) { using namespace std; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); cout << "Wholesale cost = $" << cost << endl << "Expected time until sold = " << turnover << " days" << endl << "Retail price= $" << price << endl; } //This is only a stub: double price(double cost, int turnover) { return 9.99; //Not correct, but good enough for some testing. }