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

Markup: Please hand in your source code and runs to test valid and invalid data.

ID: 3729313 • Letter: M

Question

Markup:

Please hand in your source code and runs to test valid and invalid data.

Write a program that asks the user to enter an 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 100%, then the item’s retail price is 10.00.

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 which enters and returns valid data the wholesale cost and its markup percentage.

void getData(double&,double&);

The program should have a function named

double calculateRetail(double,double);

that receives the wholesale cost and the markup percentage as arguments, and returns the retail price of the item.

The program should have a function to display the results given the wholesale cost, the markup percentage and the retail price.

            void Display(double,double,double);

Input validation: Do not accept a negative values for either the wholesale cost of the item or the markup percentage. .

Please hand in your source code and runs to test valid and invalid data.

Explanation / Answer

Please find my implementation.

#include <iostream>

using namespace std;

void getData(double&,double&);

double calculateRetail(double,double);

void Display(double,double,double);

int main() {

double whole, markup, retail;

getData(whole, markup);

retail = calculateRetail(whole, markup);

Display(whole, markup, retail);

return 0;

}

void getData(double &whole,double &markup) {

cout<<"Enter wholesale price: ";

cin>>whole;

cout<<"Enter markup percentage: ";

cin>>markup;

}

double calculateRetail(double whole,double markup) {

return whole + (whole*markup)/100;

}

void Display(double whole,double markup,double retail) {

cout<<"Retail price of item is "<<retail<<" whose wholesale price is "<<whole<<", and markup is "<<markup<<endl;

}