/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package uhb2;
/**
*
* @author user
*/
import java.io.*;
public class Uhb2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
int i, n, data, harga = 500000;
BufferedReader x = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Banyaknya Data : ");
n = Integer.parseInt(x.readLine());
String[] nama;
nama = new String[n];
int[] tiket, jumlah;
double[] total, diskon;
tiket = new int[n];
jumlah = new int[n];
total = new double[n];
diskon = new double[n];
for (i=0; i<n; i++){
System.out.println("\nData ke - "+(i+1));
System.out.print("Nama Penumpang : ");
nama[i]=x.readLine();
System.out.print("Jumlah Pembelian : ");
jumlah[i]=Integer.parseInt(x.readLine());
}
for (i=0; i<n; i++){
System.out.println("\n\nData ke - "+(i+1));
System.out.println("Nama : "+nama[i]);
System.out.println("Harga Tiket : "+harga);
System.out.println("Jumlah Tiket : "+jumlah[i]);
if (jumlah[i]>3){
diskon[i]=0.1*jumlah[i]*harga;
total[i]=(jumlah[i]*harga)-diskon[i];
}
else {
diskon[i]=0;
total[i]=(jumlah[i]*harga)-diskon[i];
}
System.out.println("Total : "+total[i]+"\n");
}
}
}
Friday, 18 October 2013
Uhb2 Ony
Supported by Alens Papatanger di 23:09:00
Subscribe to:
Post Comments (Atom)
0 Komentar:
Post a Comment