Question: Find any syntax and logical errors in the following function. Briefly describe why they are errors and how to fix them: / / The calcDiscountPrice

Find any syntax and logical errors in the following function. Briefly describe
why they are errors and how to fix them:
// The calcDiscountPrice function accepts an item's price
// and the discount percentage as arguments. It uses those
// values to calculate and return the discounted price.
void calcDiscountPrice(double price, double percentage)
{
double discountAmount = price * percentage;
double updatedPrice = price - discountAmount;
return updatedPrice;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!