Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is C++. Write a C++ program that asks the user to enter an item\'s descript

ID: 3685846 • 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>
using namespace std;
double calculateRetail(double rcost,double markup)
{
return rcost*(1+markup/100);
}
int main()
{
while(1)
{
string item;
double rcost,markup;
  
cout<<"Enter item description:";
cin>>item;
cout<<"You entered "<<item<<' ';
  
cout<<"Enter item wholesale cost:";
cin>>rcost;
cout<<"You entered "<<rcost<<' ';
  
cout<<"Enter item markup percentage:";
cin>>markup;
cout<<"You entered "<<markup<<' ';
  
cout<<"The retail price for "<<item<<" is "<<calculateRetail(rcost,markup)<<' ';
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote