![【PHP/演習問題】if文[2]](https://it-hack.net/image/thumbnail-missing.png) 
        【PHP/演習問題】if文[2]
問題
お店のお会計で割引を適用するプログラムを作成してください。
	
なお、下記の条件を満たすものとします。
- 合計金額は『単価×個数』で計算する
- 単価と個数はコマンドライン引数で与える(単価、個数の順)
- 割引は個数が5個以上かつ合計金額が10,000円以上の場合、合計金額から15%OFF
$ php practice.php 3000 5
割引金額         : 2250円
合計金額(割引前) : 15000円
合計金額(割引後) : 12750円解答例
<?php
// 単価
$price = $argv[1];
// 個数
$unit = $argv[2];
// 合計金額(割引前)
$subtotal = $price * $unit;
// 合計金額(割引後)
$total = $subtotal;
// 割引金額
$discount = 0;
// 割引の適用
if( $unit >= 5 && $subtotal >= 10000 ) {
    $discount = $subtotal * 0.15;
    $total = $subtotal - $discount;
}
echo '割引金額         : '.$discount."円\n";
echo '合計金額(割引前) : '.$subtotal."円\n";
echo '合計金額(割引後) : '.$total."円\n";
?> 
         
        ![【コマンドライン】ユーザーのグループ確認 [ groups ]](https://it-hack.net/storage/app/media/document/development/os/command/groups/thumbnail_0001.png) 
        ![【コマンドライン】ユーザー・グループの確認 [ getent ]](https://it-hack.net/storage/app/media/document/development/os/command/getent/thumbnail_0001.png) 
         
         
         
         
         
         
         
        