Advertisement
AlphaPenguino

priceAndQuantity_Discount

Oct 27th, 2022 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | Source Code | 0 0
  1.  
  2. package practice.programpractice;
  3.  
  4. //1.0.3
  5.  
  6. import java.util.*;
  7. public class priceAndQuantity {
  8.    
  9.     public static void main(String[] args) {
  10.        
  11.         Scanner sc = new Scanner(System.in);
  12.         System.out.println("Enter the QTY: ");
  13.         double qty = sc.nextInt();
  14.         System.out.println("Enter the PR: ");
  15.         double pr = sc.nextInt();
  16.        
  17.         double bill = qty * pr;
  18.        
  19.         //System.out.println(bill);
  20.         if (bill >= 5000) {
  21.          double discount = bill *  0.25;
  22.          double totalBill = bill - discount;
  23.          System.out.println("You saved " + discount + "\nfrom " + bill + " original price\n\nThe Total Bill amount is " + totalBill);
  24.         }
  25.         else
  26.         System.out.println("The total bill amount is " + bill);
  27.        
  28.        
  29.     }
  30.    
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement