Laura Barber

Software Engineering Blog

Blog
About
Email
Twitter
LinkedIn
GitHub

30 Mar 2015
Chapter 6

SD Exercise 6.1

private $employer;
private $contact_person;
private $contact_phone;

function set_employer($employ){
    $this->employer = $employ;
}

function get_employer(){
    return $this->employer;
}

function set_contact($cont){
    $this->contact_person = $cont;
}

function get_contact(){
    return $this->contact;
}

function set_contact_phone($cphone){
    $this->contact_phone = $cphone;
}

function get_contact_phone(){
    return $this->contact_phone;
}

SD Exercise 6.2

Working off the existing prototype in the code, a new constructor would be as follows:

function __construct($f, $l, $a, $c, $s, $z, $p1, $p2, $e, $t,
$bg, $in, $sh, $con, $whe, $exp, $mot, $spe, $av, $sch, $hist, 
$bd, $sd, $pubn, $myn, $privn, $pass, $status, $employer, $contact, $contact_phone) {
    ...
    $this->status = $status;
    $this->employer = $employer;
    $this->contact = $contact;
    $this->contact_phone = $contact_phone;
}

SD Exercise 6.3

We would need to check if the status is set to active or inactive, and if it is not, default it to inactive.

SD Exercise 6.4

Almost all of the setters and getters I encountered in Person.php were unused as far as I could find. Removal should not cause any problems with testing.


Laura Barber at 1:38PM