//Andrew Alspaugh CS1A Chapter 6. p. 369. #1
//
/************************************************************************
* Calculate Retail Price
*_______________________________________________________________________
* This program calculates takes the price of a wholesale item and
* calculates retail price of any markup rate
* _____________________________________________________________________
* INPUT
* whole Wholesale Price
* markup Markup Rate
* OUTPUT
* retail Retail Price
* **********************************************************************/
#include <iostream>
using namespace std;
int main()
{
// Function Prototype Calculate
float CalculateRetail(float whole, float markup);
//Data Dictionary
float whole; //INPUT WHOLESALE PRICE
float markup; //INPUT MARKUP RATE
float retail; //OUTPUT RETAIL PRICE
// INPUT
//Input Wholesale Price
cout << "Enter Wholesale Price: " << endl;
cin >> whole;
//Wholesale Validation
while(whole <= 0)
{
cout << "Wholesale price must be greater than 0" << endl;
cin >> whole;
}
cout << "Wholesale price is: " << whole << endl;
//Input Markup Rate
cout << "Enter Markup Rate: " << endl;
cin >> markup;
//Markup Rate Validation
while (markup <= 0)
{
cout << "Markup rate must be greater than 0" << endl;
cin >> markup;
}
cout << "Markup Rate is: " << markup << endl;
//PROCESS
retail = CalculateRetail(whole, markup);
//OUTPUT
cout << "Retail Price is: " << retail << endl;
return 0;
}
/**************************************************************************
* CalculateRetail() Definition
* multiplies whole by markup + 100 and divides the whole by 100 to calculate
* retail price
**************************************************************************/
float CalculateRetail(float whole, float markup)
{
return (whole * (markup + 100))/100;
}