You are on page 1of 5

//Umadevi a/p Krishnan sammy

//02DEC14F2055

// A program that reads code, name, price, quantity of products and name of customers,address to
calculate out the total amount of product purchased by the customer.

import java.util.Scanner;

import javax.swing.*;

class sushi

{

public static void main(String[] args)

{

Scanner input=new Scanner(System.in);

System.out.print("How many item??");

int b=input.nextInt();

title(); //METHOD

System.out.println("_________________________________________________________________
_______________");

System.out.println(" LIST OF ITEM ");

System.out.println("_________________________________________________________________
_______________");

System.out.println("NO."+"\tCODE"+"\tITEMNAME"+"\tPRICE(RM)");

//DECLARATION

String[] code=new String[b];

String[] itemname=new String[b];

String[] harga=new String[b];

String[] price=new String[b];

//PROMPT AND READS NAMES FROM USER

for (int j=0;j<b;j++)

{

//INPUT FROM MESSAGE BOX

showInputDialog(null.println("Cashier:"+cash+"\nDate:"+tarikh+"\t("+day+")\tTime:"+masa).out.j<b.println("_________________________________________________________________ _______________"). //DISPLAY CASHIER NAME String cash=JOptionPane. System. String day=JOptionPane.out.println("_________________________________________________________________ _______________"). System. System. } System. String masa=JOptionPane.showInputDialog(null."Enter Time").code[j]=JOptionPane. } for (int j=0.out.showInputDialog(null. System."Enter Price").j++) { System.out.print("How many item that customer buy??"). //DISPLAY THE CUSTOMER NAME WHO BUY THE ITEM System.showInputDialog(null. title().out. .nextInt().out.showInputDialog(null. System.out."Enter Date"). itemname[j]=JOptionPane.println("_________________________________________________________________ _______________")."Enter Day"). harga[j]=JOptionPane."Enter Item Name").println(" TOTAL SALES ").println("_________________________________________________________________ _______________"). String tarikh=JOptionPane."Enter Code").showInputDialog(null."Enter Cashier Name").println("_________________________________________________________________ _______________"). //METHOD System.out.showInputDialog(null. int c=input.println(j+1+"\t"+code[j]+"\t"+itemname[j]+"\t"+"\t"+harga[j]).out.

//CALCULATION .out.print(l). String[] quantity=new String[c]. if(kode[k]. int l=0. String[] kode=new String[b]. System. //PROMPT AND READS NAMES FROM USER for(int k=0.showInputDialog(null.k++) { l=l+1.parseDouble(harga[k]). System."ENTER THE QUANTITY").print("\t"+kode[k]).out.out.println("NO. } quantity[k]=JOptionPane."+"\tCODE"+"\t"+"ITEMNAME"+"\t(RM)"+"\t\tQUANTITY"+"\tTOTAL(RM)").k<c.equals(kode[k])) { System. double harga_1=Double.out.print("\t"+itemname[k]+"\t"+"\t"+harga[k]).parseInt(quantity[k]).showInputDialog(null. String[] nameitem=new String[b]. int[] kuantiti=new int[c]. kuantiti[k]=Integer. double total_1=0.balance=0. kode[k]=JOptionPane."ENTER THE KODE").out.print("\t"+"\t"+quantity[k]). double[] eprice=new double[b]. System. //DECLARATION int Total. double total=0.System.

println(" "). System.println(" JALAN BANDAR KUANTAN "). subtotal=JOptionPane.out.total_1.println("subtotal="+subtotal1). . System.k++) System.out.parseDouble(subtotal).println("balance="+balance).total=kuantiti[k]*harga_1.out.out. System.println("\t"+"\t"+total).out.out. System. balance= subtotal1 .println(" PLEASE COME AGAIN ").showInputDialog(null.println(" ALL PRICE INCLUDE GST ").println(" Total:"+ total_1 ).out.out.println("_________________________________________________________________ _______________").out. String subtotal. System. } static void title() { System. total_1=total_1+total. System. System.out.println("_________________________________________________________________ _______________"). double subtotal1.println(" SUSHI KING EAST COAST MALL ").println(" THANK YOU FOR PURCHASE OUR ITEMS ").println("_________________________________________________________________ _______________"). System.out.k<c."Enter the subtotal").println(" KUANTAN 25000 PAHANG ").out. System. System. } for(int k=0. System. subtotal1=Double.out.out. System.

println("_________________________________________________________________ _______________").out.println(" NO TEL:09-5609221 ").out. } } .println(" GST ID:001213038592 ").out.System. System. System.