-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLesson.php
57 lines (43 loc) · 1.08 KB
/
Lesson.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
abstract class Lesson
{
protected $duration;
const FIXED =1 ;
const TIMED =2 ;
private $costtype;
function __construct($durantion , $costtype =1 ) {
$this->duration = $durantion;
$this->costtype = $costtype;
}
function cost() {
switch ($this->costtype) {
case self::TIMED :
return (5 *$this->duration);
break;
case self::FIXED :
return 30;
break;
default ;
$this->costtype =self::FIXED;
return 30;
}
}
function chargeType() {
switch ($this->costtype) {
case self::TIMED :
return "hourly rate";
break;
case self::FIXED :
return "fixed rate";
break;
default :
$this->costtype = self::FIXED;
return "fixed rate";
}
}
}
class Lecture extends Lesson {
}
class Seminar extends lesson {
}
?>