Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication1;
- import java.util.Scanner;
- public class SoftwareSales {
- public static void main(String[] args) {
- double quantity, cost, discount, totalAmount;
- String input;
- Scanner scn = new Scanner(System.in);
- System.out.print("Enter the number of items purchased");
- input = scn.nextLine();
- quantity = Double.parseDouble(input);
- if(quantity >= 10 && quantity <= 19)
- {
- cost = (quantity * 99);
- discount = (cost*0.2);
- totalAmount = (cost - discount);
- System.OutOfMemoryError.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
- }
- if(quantity >= 50 && quantity <=99)
- {
- cost = (quantity * 99);
- discount = (cost*0.4);
- totalAmount = (cost - discount);
- System.Out.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
- if(quantity >= 100)
- {
- cost = (quantity * 99);
- discount = (cost*0.5);
- totalAmount = (cost - discount);
- System.Out.println("Discount amount:"+discount+"\n Total amount. "+ totalAmount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement