Question #36248

"Hi, I'm new in C++ and I need a program that calculate the final price of an item with a 25% of discount and a sales tax of 7%, can someone help me?
1

Expert's answer

2013-11-04T06:58:10-0500
#include <iostream>
using namespace std;
double CalculateFinalPrice(double item_price, double discount_percent, double sales_tax_percent)
{
    double final_price = item_price * (1.0 - discount_percent / 100.0) * (1.0 + sales_tax_percent / 100.0);
    return final_price;
}
int main(int argc, char* argv[])
{
    double item_price = 0.0;
    cout << "Price of an item: ";
    cin >> item_price;
    double final_price = CalculateFinalPrice(item_price, 25.0, 7.0);
    cout << "Final price: " << final_price << endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS