//Eric Bernal CS1A Chapter 6, P. 369, #1
//
/*******************************************************************************
* CALCULATE WHOLESALE RETAIL MARKUP PRICE
* _____________________________________________________________________________
* This program is given a mark up percentage and a wholesale price, which then
* calculates the values to produce the retail cost.
* _____________________________________________________________________________
* Input
* markupPercent : A given mark up that is a percentage.
* wholesale : A given wholesale price.
*
* Output
* retailPrice : The cost of the retail item after the markup price.
******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
// Function Prototype
float calculateRetail(float markUp, float Cost);
int main() {
// Data Dictionary - Initialize all Variables
float markupPercent; //INPUT : A given markup as a percentage.
float wholesale; //INPUT : A given wholesale cost.
float retailCost; //OUTPUT: The retail price after markup.
//Obtain Mark Up Percentage and Wholesale Price
cout << "Enter the mark up percentage as a whole number." << endl;
cin >> markupPercent;
cout << "Enter the wholesale price of the item." << endl;
cin >> wholesale;
// Input Validation
if (markupPercent >= 100 || markupPercent <= 0)
{
cout << "Error: Please enter a positive value from 0 to 100." << endl;
cin >> markupPercent;
}
if (wholesale <= 0)
{
cout << "Error: Please enter a positive whole number." << endl;
cin >> wholesale;
}
//Calculate retail price + Function Call
retailCost = calculateRetail(markupPercent, wholesale);
// Output display
cout << "Wholesale Price : " << wholesale << "\nMarkup Percentage Rate: "
<< markupPercent << "\nRetail Price : " << retailCost << endl;
return 0;
}
/*******************************************************************************
* This function's purpose is to calculate the retail price of an item.
******************************************************************************/
//Function Header
float calculateRetail(float a, float b)
{
float c;
c = b + (b*(a/100));
return c;
}