Discount dilemma: The price puzzle

Report a typo

A store is calculating the final price of a product. You have the following variables:

  1. The base price is $100;

  2. The tax rate is 8%;

  3. And there's a $10 discount.


Can you reorder the lines of code to correctly calculate and print the final price?

Reorder lines using drag or arrows. Adjust indentation with left buttons
                double taxAmount = basePrice * (taxRate / 100);
              
                double basePrice = 100.0, taxRate = 8.0, discountAmount = 10.0;
              
                double finalPrice = basePrice + taxAmount - discountAmount;
              
                }
              
                }
              
                public static void main(String[] args) {
              
                System.out.printf("Final price: $%.2f\n", finalPrice);
              
                public class ProductPriceCalculator {
              

Create a free account to access the full topic