Program java kasir

Posted by mahfuz On Senin, 07 November 2011 0 komentar
import java.io.*;


public class penjualan1
{
public static void main(String[] args) throws Exception
{
String[]namaBarang = new String[50];
int[]jumlahBarang = new int[100];
int[]hargaBarang = new int[100];


DataInputStream karakter = new DataInputStream(System.in);
System.out.println("");
System.out.println("============================");
System.out.println("| TOKO LAPTOP MAHFUZ SETIA |");
System.out.println("============================");
System.out.println("Menjual berbagai jenis laptop");
System.out.println("jl. Tembusan Ambarawa No. 41 C");
System.out.println("");
System.out.print("BULAN PENJUALAN   : ");
String bulan=karakter.readLine();


System.out.print("JUMLAH BARANG     : ");
String jumlah=karakter.readLine();
int data = Integer.valueOf(jumlah).intValue();
for(int i=0;i<data;i++)
{


System.out.println("");
System.out.print("NAMA BARANG KE-"+(i+1)+"  : ");
String nama=karakter.readLine();
namaBarang[i]=nama;


System.out.print("JUMLAH            : ");
String jlh=karakter.readLine();
int jlah = Integer.valueOf(jlh).intValue();
jumlahBarang[i]=jlah;


System.out.print("HARGA Rp          : ");
String har=karakter.readLine();
int harga = Integer.valueOf(har).intValue();
hargaBarang[i]=harga;
}


System.out.println("");
System.out.println("LAPORAN PENJUALAN PT. MAHFUZ SETIA");
System.out.println("BULAN : "+bulan);
System.out.println("");
System.out.println("===============================================");
System.out.println("NO | N.BARANG | JUMLAH |   HARGA   |  TOTAL   |");
System.out.println("===============================================");
int totalPenjualan=0;
for(int i=0;i<data;i++)
{


System.out.println((i+1)+"    "+namaBarang[i]+"      "+jumlahBarang[i]+ "      "+hargaBarang[i]+"     "+(jumlahBarang[i]*hargaBarang[i]));


totalPenjualan = totalPenjualan + (jumlahBarang[i]*hargaBarang[i]);
}
System.out.println("===============================================");
System.out.println("TOTAL JENIS BARANG : "+data);
System.out.println("TOTAL PENJUALAN    : "+totalPenjualan);
System.out.println("");
System.out.println("===============================================");
System.out.println("| ^_^..TERIMA KASIH ATAS KUNJUNGAN ANDA...^_^ |");
System.out.println("===============================================");
}
}

0 komentar:

Posting Komentar