Make a flowchart import java.util.Scanner; public class CommodityCode{ public static void main(String[] args){ Scanner X = new Scanner(System.in); System.out.println("Enter commodity code:"); char...


Make a flowchart




import java.util.Scanner;


public class CommodityCode{


   public static void main(String[] args){


           Scanner X = new Scanner(System.in);
                System.out.println("Enter commodity code:");
                       char code=X.next().charAt(0);
                System.out.println("Enter quantity of commodity:");
                       float quantity=X.nextFloat ();
                System.out.println("Enter unit price:");
                        float price=X.nextFloat();


        float total = quantity * price;


                switch(code){

                        case 'X':
                           double discount = total * .08;
                             System.out.println ("Amount to be paid is :"+ (total - discount));
                   break;
                        case 'Y':
                           double tax = total * .11;
                             System.out.println ("Amount to be paid is :"+ (total + tax));
                   break;
                        case 'Z':
                             System.out.println ("Amount to be paid is :"+ price * quantity * 1);
                   break;


                default :
                             System.out.println ("Invalid Code");


                }


        }


}



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here