0% found this document useful (0 votes)
62 views

Codes For Java

The program prompts the user to input a purchaser's name, item code, quantity purchased, and payment code. Based on the item code, it determines the item type and unit price. It then calculates the gross bill, additional charges if paying by check, and net bill to display to the user.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Codes For Java

The program prompts the user to input a purchaser's name, item code, quantity purchased, and payment code. Based on the item code, it determines the item type and unit price. It then calculates the gross bill, additional charges if paying by check, and net bill to display to the user.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

public static void main(String[]arg){

String sname,pt="",ses="";
int icode,qp;
double pct=0,pc,ac,nb,up = 0,gb;

System.out.print("");
Scanner in = new Scanner(System.in);
System.out.print("Purchaser Name : ");
sname = in.nextLine();
System.out.print("Item Code (15-65) : ");
icode = in.nextInt();

if (icode <=36) {ses="Hakata Printer" ;up = 6560.50;}


if (icode >=50) {ses="Atami System Unit";up= 9365.50;}
if (icode >=58 ) {ses="Hakata Monitor";up= 5500.43;}
if (icode >=59 ) {ses="Hakone Keyboard";up= 3678.99;}

System.out.print("Qty Pruchase (2-50) : ");


qp = in.nextInt();

System.out.print("Payment Code (1/2) : ");

pc = in.nextFloat();
if (pc==1) { pt="cash"; pct=0; }
if (pc==2) { pt="check"; pct=10; }

gb=qp*up;
ac=gb*pct/100;
nb=gb+ac;

System.out.println("");
System.out.println("Purchaser Name : " +sname);
System.out.println("Item Type : " +ses);
System.out.println("Payment Type : " +pt);
System.out.println("Net Bill : " +nb);

}
}

You might also like