-
Notifications
You must be signed in to change notification settings - Fork 0
/
task3.txt
57 lines (43 loc) · 1.44 KB
/
task3.txt
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
<!DOCTYPE html>
<head>
<title>Assignment3</title>
</head>
<body>
<?php include 'menu.inc';
class AssignmentRecord{
protected $studentNum;
protected $assignment1;
protected $assignment2;
protected $assignment3;
const ass1Weight = .1;
const ass2Weight = .1;
const ass3Weight = .8;
function __construct($studNum,$ass1,$ass2,$ass3){
$this->studentNum = $studNum;
$this->assignment1 = $ass1;
$this->assignment2 = $ass2;
$this->assignment3 = $ass3;
}
function yearMark(){
return $this->assignment1*ass1Weight+$this->assignment2*ass2Weight+$this->assignment3*ass3Weight;
}
function __toString(){
return $this->studentNum.",".$this->assignment1.",".$this->assignment2.",".$this->assignment3;
}
}
class FullRecord extends AssignmentRecord{
private $examMark;
function __construct($studNum,$ass1,$ass2,$ass3,$examMark){
$this->examMark =$examMark;
$this->studentNum = $studNum;
$this->assignment1 = $ass1;
$this->assignment2 = $ass2;
$this->assignment3 = $ass3;
}
function __toString(){
return AssignmentRecord::__toString().",".$this->examMark;
}
}
$fullRecord = new FullRecord(123456,70,80,50,55);
echo $fullRecord->__toString();
?>