no message
This commit is contained in:
19
Question02-Calculation/Ex10.php
Normal file
19
Question02-Calculation/Ex10.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$moneyInHand = 1000; // 所持金
|
||||
$coffee = 120; // コーヒーの値段
|
||||
$snack = 200; // スナック菓子の値段
|
||||
|
||||
/*
|
||||
* ● 1本あたり120円(税別)の缶コーヒーを2本
|
||||
* ● 1袋あたり200円(税別)のスナック菓子を1袋
|
||||
*
|
||||
* 上記商品を購入した時の所持金を表示してください
|
||||
* ※ 消費税は、全商品の合計に8%が加算されます
|
||||
* ※ 日本円には小数点がありませんので、整数の値で出力してください
|
||||
*/
|
||||
$total = ($coffee * 2) + $snack;
|
||||
$tax = $total * 0.08;
|
||||
$taxTruncation = floor($tax);
|
||||
$moneyInHand = $moneyInHand - ($total + $taxTruncation);
|
||||
echo '所持金' . $moneyInHand;
|
||||
Reference in New Issue
Block a user