Answer to Question #288604 in C++ for Gurpz

Question #288604

Write a C++ code that will calculate the amount that a customer need to pay after the discount. The customer just need to key in the total amount and the program will calculate the discounted amount accordingly. For total amount more than RM500.00 the discount value is 10%. For total amount less than RM500.00 the discount value is 8%.


1
Expert's answer
2022-01-19T01:55:11-0500
#include <iostream>

int main()
{
    double amount = 0, discount = 8;
    std::cout<<"Enter the total amount: ";
    std::cin>>amount;
    if(amount >= 50000)
    {
        discount = 10;
    }
    std::cout<<"Amount - discount is: "<<amount - amount * discount / 100<<std::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!

Leave a comment

LATEST TUTORIALS
New on Blog