Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. package javaapplication1;
  3. import java.util.Scanner;
  4. public class SoftwareSales {
  5.  
  6. public static void main(String[] args) {
  7. double quantity, cost, discount, totalAmount;
  8. String input;
  9.  
  10. Scanner scn = new Scanner(System.in);
  11. System.out.print("Enter the number of items purchased");
  12. input = scn.nextLine();
  13. quantity = Double.parseDouble(input);
  14. if(quantity >= 10 && quantity <= 19)
  15. {
  16. cost = (quantity * 99);
  17. discount = (cost*0.2);
  18. totalAmount = (cost - discount);
  19. System.OutOfMemoryError.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
  20. }
  21. if(quantity >= 50 && quantity <=99)
  22. {
  23. cost = (quantity * 99);
  24. discount = (cost*0.4);
  25. totalAmount = (cost - discount);
  26. System.Out.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
  27.  
  28. if(quantity >= 100)
  29. {
  30. cost = (quantity * 99);
  31. discount = (cost*0.5);
  32. totalAmount = (cost - discount);
  33. System.Out.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
  34. }
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement