progam penjualan tiket dengan java
import java.io.*;
public class test04{
public static void main (String [] args)
throws IOException{
InputStreamReader key=new
InputStreamReader(System.in);
BufferedReader input = new
BufferedReader (key);
int i,n;
String np[],jrs[],kls[];
int jbl[],hg[],jp[];
int tp=0;
System.out.println("Daftar penjualan
Tiket ");
System.out.print("jumlah
penumpang:");
n=Integer.parseInt(input.readLine());
np=new String[n];
jrs=new String[n];
kls=new String[n];
jbl=new int[n];
hg=new int[n];
jp=new int[n];
for (i=0; i System.out.println(" ");//
input data
System.out.println("Data ke - :"+i);
System.out.print("Input nama
penumpang :");
np[i]=input.readLine();
System.out.print("Input jurusan :");
jrs[i]=input.readLine();
System.out.print("Kereta kelas [A/B/
E]:");
kls[i]=input.readLine();
System.out.print("Jumlah Tiket :");
jbl[i]=Integer.parseInt
(input.readLine());
if(kls[i].equalsIgnoreCase("A"))//
kondisi
{hg[i]=20000;jp[i]=jbl[i]*hg[i];}
else if(kls[i].equalsIgnoreCase("B"))
//kondisi
{hg[i]=15000;jp[i]=jbl[i]*hg[i];}
else if(kls[i].equalsIgnoreCase("E"))
//kondisi
{hg[i]=10000;jp[i]=jbl[i]*hg[i];}
else{hg[i]=0;jp[i]=jbl[i]*hg[i];}
System.out.println("kelas kereta :
"+kls[i]);
System.out.println("Harga
Tiket :"+hg[i]);
}
for(i=0;i System.out.println(" ");
System.out.println("nama
penumpang :"+np[i]);
System.out.println("Kelas
Kereta :"+kls[i]);
System.out.println("harga
tiket:"+hg[i]);
System.out.println("jumlah
beli :"+jbl[i]);
System.out.println("Jumlah
pembayaran :"+jp[i]);
tp=tp+jp[i];
}
System.out.println(" ");
System.out.println
("----------------------");
System.out.println(" total
penjualan :"+tp);
}
}
public class test04{
public static void main (String [] args)
throws IOException{
InputStreamReader key=new
InputStreamReader(System.in);
BufferedReader input = new
BufferedReader (key);
int i,n;
String np[],jrs[],kls[];
int jbl[],hg[],jp[];
int tp=0;
System.out.println("Daftar penjualan
Tiket ");
System.out.print("jumlah
penumpang:");
n=Integer.parseInt(input.readLine());
np=new String[n];
jrs=new String[n];
kls=new String[n];
jbl=new int[n];
hg=new int[n];
jp=new int[n];
for (i=0; i System.out.println(" ");//
input data
System.out.println("Data ke - :"+i);
System.out.print("Input nama
penumpang :");
np[i]=input.readLine();
System.out.print("Input jurusan :");
jrs[i]=input.readLine();
System.out.print("Kereta kelas [A/B/
E]:");
kls[i]=input.readLine();
System.out.print("Jumlah Tiket :");
jbl[i]=Integer.parseInt
(input.readLine());
if(kls[i].equalsIgnoreCase("A"))//
kondisi
{hg[i]=20000;jp[i]=jbl[i]*hg[i];}
else if(kls[i].equalsIgnoreCase("B"))
//kondisi
{hg[i]=15000;jp[i]=jbl[i]*hg[i];}
else if(kls[i].equalsIgnoreCase("E"))
//kondisi
{hg[i]=10000;jp[i]=jbl[i]*hg[i];}
else{hg[i]=0;jp[i]=jbl[i]*hg[i];}
System.out.println("kelas kereta :
"+kls[i]);
System.out.println("Harga
Tiket :"+hg[i]);
}
for(i=0;i System.out.println(" ");
System.out.println("nama
penumpang :"+np[i]);
System.out.println("Kelas
Kereta :"+kls[i]);
System.out.println("harga
tiket:"+hg[i]);
System.out.println("jumlah
beli :"+jbl[i]);
System.out.println("Jumlah
pembayaran :"+jp[i]);
tp=tp+jp[i];
}
System.out.println(" ");
System.out.println
("----------------------");
System.out.println(" total
penjualan :"+tp);
}
}
0 komentar:
terima kasih atas kunjungan anda
http://tugasbloger.blogspot.com/