//Matthew Santos     CS1A     Ch. 6, Pg. 239, #1
/***********************************************
 * 
 * CALCULATE RETAIL PRICE
 * _____________________________________________
 * Calculates the retail price of an item based
 * off the wholesale cost and markup percentage.
 * _____________________________________________
 * INPUT
 *      wholesaleCost : wholesale cost of item
 *      markupPercent : markup percentage of item
 * 
 * OUTPUT
 *      retail        : retail price of item
 ***********************************************/
#include <iostream>
using namespace std;
 
double calculateRetail(double, double);
 
int main() {
    double wholesaleCost;
    double markupPercent;
    double retialPrice;
 
    // Ask for input
    cout << "Enter the item's wholesale cost: ";
    cin >> wholesaleCost;
 
    // Validate inputs
    while (wholesaleCost < 0) {
        cout << "Wholesale cost cannot be negative. Enter again: ";
        cin >> wholesaleCost;
    }
 
    cout << "Enter the item's markup percentage: ";
    cin >> markupPercent;
 
    while (markupPercent < 0) {
        cout << "Markup percentage cannot be negative. Enter again: ";
        cin >> markupPercent;
    }
 
    // Calculate and display retail price
    double retailPrice = calculateRetail(wholesaleCost, markupPercent);
    cout << "The item's retail price is $" << retailPrice << endl;
 
    return 0;
}
 
double calculateRetail(double wholesaleCost, double markupPercent)
{
    return wholesaleCost + (wholesaleCost * markupPercent / 100);
}