This is C++. Write a C++ program that asks the user to enter an item\'s descript
ID: 3685699 • Letter: T
Question
This is C++.
Write a C++ program that asks the user to enter an item's description (see sample program runs below for examples.) The program then asks for the item's wholesale cost and its markup percentage. It should then display the item's retail price. For example, if an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50.
The program should have a function named calculateRetail that receives the wholesale cost and the markup percentage as arguments and returns the retail price of the item.
Sample program runs are as follows, where user input is shown in red color:
Explanation / Answer
#include <iostream>
#include<string.h>
using namespace std;
float calculateRetail(int itemCost,float itemMarkUpPercentage)
{
return itemCost +(itemCost*itemMarkUpPercentage)/100;
}
int main()
{
string itemDescription;
int itemCost;
float itemRetailCost,itemMarkUpPercentage;
cout << "Enter item description: ";
cin>>itemDescription;
cout<< "You have entered "<<itemDescription<<endl;
cout << "Enter item wholesale cost: ";
cin>>itemCost;
cout<< "You have entered "<<itemCost<<endl;
cout << "Enter item markup percentage: ";
cin>>itemMarkUpPercentage;
cout<< "You have entered "<<itemMarkUpPercentage<<endl;
//call function to clculate retail price
cout<<"Retail price for "<<itemDescription <<" is "<<calculateRetail(itemCost,itemMarkUpPercentage)<<endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.