A company applies a discount based on the price of the order
Solution
import java.util.Scanner;
public class Discount {
   public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println(\"Enter the total price\");
        double price = sc.nextDouble();
        double discountedPrice = getDiscountedPrice(price);
        System.out.println(\"Discounted price of the order is : \"+discountedPrice);
}
   private static double getDiscountedPrice(double price) {
       
        double discountedPrice = 0.0 ;
        // required if else conditions ANS of question
        if(price > 100){
            discountedPrice = price - (price * 0.10);
        }
        if(price > 50 && price <= 100){
            discountedPrice = price - (price * 0.05);
        }
        if(price <= 50 ){
            discountedPrice = price;
           
        }
       
        // ans using if else statements
        /*if(price > 100){
            discountedPrice = price - (price * 0.10);
        }else if(price > 50){
            discountedPrice = price - (price * 0.05);
        }else{
            discountedPrice = price;
           
        }*/
        return discountedPrice;
    }
}

