An online shopping platform is having a sale and offering customers a discount depending on how much they spend. The discount levels are listed below. Customers are given the highest discount level that they qualify for (they never receive multiple discount levels).
There are two additional rules:
You are given a double
variable subtotal
that represents a customer's purchase total before applying the
discount. You are also given boolean
variables hasMembership
and hasCouponCode
. You should calculate the
customer's final total after applying the discount and store it in double
variable named finalTotal
that you
will need to declare. Fractional cents are okay; do not worry about restricting your answer to two decimal places.
Stuck? You may find these lessons helpful: