/*******************************************************************************
* Aiden Stannard // CS1A // Chapter 6 Homework: Challange 1# // 10/17/2026
*
* Retail Price Calculator
*
* This Program a accepts a wholesale price and retail markup percentage of an
* item and outputs the retail price.
*
* Input:
*
* Enter the item's wholesale cost in USD: $___
* Enter the markup percentage:___
*
* Output:
* This item's retail price is $___
******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototype
float calculateRetail(float wholesale, float markup);
int main()
{
// Holds the values of the user inputs
float wholesale;
float retail; // Holds the value of the return value of "calculateRetail"
float markup;
cout << "Enter the item's wholesale cost in USD: $";
cin >> wholesale;
while (wholesale < 0) // stops negative inputs
{
cout << "The wholesale cost cannot be negative. Please re-enter: $";
cin >> wholesale;
}
cout << "Enter the markup percentage: ";
cin >> markup;
while (markup < 0) // stops negative markup inputs
{
cout << "You cannot enter a negative markup. Re-enter A valid markup: ";
cin >> markup;
}
retail = calculateRetail(wholesale, markup);
cout << fixed << setprecision(2);
cout << "This item's retail price is $" << retail << endl;
return 0;
}
// Calculate the retail price
float calculateRetail(float wholesale, float markup)
{
return wholesale + (wholesale * (markup / 100.0));
}