-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChiTietDon.php
executable file
·60 lines (41 loc) · 1.29 KB
/
ChiTietDon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace ChiTiet;
require_once "ChiTiet.php";
class ChiTietDon extends ChiTiet
{
private $giaTien;
private $khoiLuong;
public function nhapThongTin()
{
parent::nhapThongTin();
do {
$this->khoiLuong = readline("Khoi luong: ");
if (!is_numeric($this->khoiLuong) || ($this->khoiLuong + 0) <= 0) {
echo "Nhap so (lon hon 0) thoi A Nam oi!\n";
}
} while (!is_numeric($this->khoiLuong) || ($this->khoiLuong + 0) <= 0);
do {
$this->giaTien = readline("Gia tien: ");
if (!is_numeric($this->giaTien) || ($this->giaTien + 0) <= 0) {
echo "Nhap so (lon hon 0) thoi A Nam oi!\n";
}
} while (!is_numeric($this->giaTien) || ($this->giaTien + 0) <= 0);
}
public function xuatThongTin($level)
{
$tab_string = $this->makeLevelTab($level);
echo $tab_string . "[CTD]\n";
parent::xuatThongTin($level);
echo "\n";
echo $tab_string . "Khoi Luong: " . $this->khoiLuong . "(kg)\n" ;
echo $tab_string . "Gia: " . $this->giaTien . "$\n";
}
public function getGiaTien()
{
return $this->giaTien;
}
public function getKhoiLuong()
{
return $this->khoiLuong;
}
}