I keep getting the error above. I am trying to calculate percentage, sales tax on items to make profit on items sold.

``````#include <iostream>
#include <string>

using namespace std;

int main()
{
//Declare variables
double price;
double percentage;
double taxRate;
double salesTax;
double sellingPrice;
double finalPrice;
char ch;
string str;

//Calculate Item Price

ch = '\$';
str = "Thank you for shopping at Wal-Mart.";

//Statement: Step 1 - Step
cout << "Enter original price for item: ";                                            //Step 1
cin >> price;                                                                       //Step 2
cout << endl;
cout << "The original price of the dress is  "  << ch << price << endl;             //Step 3

cout << "Enter the mark-up percentage: " << endl;                                   //Step 4
cin  >> percentage;                                                                 //Step 5
cout << endl;
cout  << "The selling price of the dress is  " << ch << percentage << endl;         //Step 6
sellingPrice = price + (1 * percentage);

cout << " Enter tax rate: " << endl;                                                //Step 7
cin  >> taxRate;                                                                    //Step 8
cout  << endl;
salesTax = sellingPrice * taxRate;
cout  << "The sales tax on the dress is  " << ch << salesTax << endl;              //Step 9

finalPrice = sellingPrice + salesTax;

cout << "Your total today is  ." << ch  << finalPrice << endl;                      //Step 10
cout << str << endl;

return 0;

}
``````

## All 2 Replies

Code tags?

What are you entering your 'percentage' in ? Does that line, multiplying percentage by 1, and adding it to the price look like what you really want to do?

``````cout << "The selling price of the dress is " << ch << percentage << endl; //Step 6
sellingPrice = price + (1 * percentage);``````

you should be calculating selling price before you display it (as of now you are saying it sells at the percentage you entered)

sellingprice should just be (1+percentage/100)*price, you probably just glanced over it....

p.s. please use code tags

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.