Excellent fertilizer wholesaler sdn bhd stocks manure in 100kg, 20kg, 10kg and 5kg sacks. write java program that will tell the wholesaler how many sacks of each weight are required to make up a retailer's order. To reduce handling problems the objectives is to use the minimum total number of sacks. If retailer having retailer-code ‘A’ or ‘a’, they cannot accept 100kg sacks. If retailer having retailer-code ‘B’ or ‘b’, they cannot accept 100kg sacks or 20kg sacks. If retailer having retailer-code ‘C’ or ‘c’, they can only accept 5kg sacks. If retailer having retailer-code ‘D’ or ‘d’, they can accept any sizes sacks. Retailers are charged $10.50 per order for handling and delivery plus : a. $5.50 per 100kg sack b. $2.35 per 20kg sack c. $1.20 per 10kg sack d. $0.80 per 5kg sack
example output:- Order quantity 154kg 100kg Sacks 1 20kg Sacks 2 10kg Sacks 1 Total number of sacks : 4kg Invoice : $21.90 i tried case A, and its not working T__T anyway here my answer Code: import java.util.*; public class orangePte { public static void main(String[]args){ String retailer_name; int retailer_code; int quantity_order; int short_order = 0; int total_no_sacks; char order_code; Scanner input = new Scanner(System.in); System.out.print("please enter retailer name :"); retailer_name = input.next(); System.out.print("please enter retailer code :"); retailer_code = input.nextInt(); System.out.print("please enter quantity order :"); quantity_order = input.nextInt(); System.out.print("order code, code)" + "A or a ()," + "B or b ()," + "C or c()," + "D or d() :"); order_code = input.next().charAt(0); switch (order_code) { case 'A': case 'a': if (quantity_order < 100 & quantity_order>20){ quantity_order = quantity_order/20; short_order = quantity_order%20; } if (quantity_order < 20 & quantity_order>10){ quantity_order = quantity_order/10; short_order = quantity_order%10; } if(quantity_order <10 & quantity_order>5){ quantity_order = quantity_order/5; short_order = quantity_order%5; } //Display quantity order, short order; System.out.println("quantity order : " + quantity_order); System.out.println("short order :" + short_order); } } }