Advertisement
ujiajah1

Diskon_Anjara_Store.php

Aug 27th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. $admin = array("Anjara Store", "Ganjar ARifin", "puji Ermanto");
  3. $lokasi = array("Soreang", "Kabupaten", "Bandung");
  4. $nama_barang = array('Case Xiaomi' => 'Case Xiaomi',
  5. 'Case Assus Zenfone' => 'Case Assus Zenfone',
  6. 'Case Redmi' => 'Case Redmi' );
  7. $harga = array("75000", "85000", "75000" );
  8.  
  9. foreach ($nama_barang as $name => $merk ){
  10.     echo "[$name]=>$merk" ."\n";
  11. }
  12. echo "Nama Barang = ".$merk. "\n";
  13. echo "Harga = ".$harga[0]." \n";
  14. echo strtoupper($admin[0]). " - ";
  15. echo strtolower($admin[1]). " - ";
  16. echo strtolower($admin[2]). " \n";
  17. echo $lokasi[0]. " " .$lokasi[1]. " ".$lokasi[2]. "\n";
  18. echo "Anda Akan Mendapat Diskon untuk Pembelian Lebih Dari 2 Item". "\n";
  19. foreach ($nama_barang as $name => $merk ){
  20. }
  21. foreach ($harga as $pay => $idr ){
  22. }
  23. $jumlah_barang = 2;
  24. echo $merk. " = ";
  25. echo "Rp. ".$idr ."\n";
  26. if ($jumlah_barang >= 2){
  27.     $diskon = (($idr*10)/100);
  28.     $bayar = $idr - $diskon;
  29.     echo "anda mendapat diskon 10%, ". "\n"
  30.     ."anda hanya perlu membayar Rp. ".$bayar. "/Item" ;
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement