Checkpoint 1.49.1.
You will see a copy of the following code block in an interactive mode than you can modify and compile. We want you to improve the style of the code as an expert would view it. You must not change the code behavior. To ensure this you can run your refactored code and ensure that it passes all the test cases.
public class FinalPrice {
public static double calculateFinalPrice(double basePrice, boolean isMember) {
double discount = 0;
if (isMember) {
discount = basePrice * 0.1;
System.out.println("Thank you for being a loyal customer!");
System.out.println("Final price is: $" + (basePrice - discount));
} else {
discount = basePrice * 0.05;
System.out.println("Join our membership for more discounts!");
System.out.println("Final price is: $" + (basePrice - discount));
}
return basePrice - discount;
}
}