Mega Store

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

Implement the getDiscountedPrice 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:

System.out.println(getDiscountedPrice(12, 100, DiscountType.Weight));

should print:

82.0
Java SE 21
Loading...
Loading...

Tags

  • AI-resistant
  • Java
  • 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 Java 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...