Isaguirre_CommodityCode.java - Isaguirre Daniel G WTHFS 1:30-6:00 import java.util.Scanner public class Isaguirre_CommodityCode public static void

Isaguirre_CommodityCode.java - Isaguirre Daniel G WTHFS...

This preview shows page 1 out of 1 page.

/** Isaguirre, Daniel G WTHFS 1:30-6:00 */ import java.util.Scanner; public class Isaguirre_CommodityCode { public static void main(String[] args) { Scanner input = new Scanner(System.in); char commodity; double commodityQuant; double unitPrice; double commodityPrice; double commodityDisc; double commodityTax; double commodityPaid; System.out.print("Enter commodity code: "); commodity = input.next().charAt(0); if(commodity == 'A'){ System.out.print("Enter quantity of commodity: "); commodityQuant= input.nextDouble(); System.out.print("Enter unit price: "); unitPrice = input.nextDouble(); unitPrice = commodityQuant * unitPrice; commodityDisc = commodityQuant * unitPrice * 0.05; commodityPaid = unitPrice - commodityDisc; System.out.format("Amount to paid is P" + "%.2f", commodityPaid); } if-else(commodity == 'B'){

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture