Mega Store

A megastore offers three types of discounts, which are represented as DiscountType enum.

Implement the get_discounted_price method which should take the total weight of the shopping cart, the total price, and the discount type. It should return the final discounted price based on the discount schemes as shown in the promotional video below:

(Open full-size video in a new tab)

For example, the following code:

printf("%.2f", get_discounted_price(12, 100, weight));

should print:

82.00
C18
Loading...
Loading...

Tags

  • AI-resistant
  • C
  • Arithmetic
  • Conditional Statements
  • Enum
  • New
  • Public
  • Easy

Information

Difficulty: Easy

Duration: 10 min

Score Distribution

Not enough data for chart.

Would you like to see our other questions?

We have 1000+ premium hand-crafted questions for 160+ job skills and 20+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.

Would you like to see our tests?

The following tests contain C related questions:

On the blog

Since we're all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they've been screening people for many years, so they must know how to do it right?

Not really. I was surprised to discover that many experts...