diff --git a/chainOfResponsibility/cashier.go b/chainOfResponsibility/cashier.go index b64e7fc..5a4f155 100644 --- a/chainOfResponsibility/cashier.go +++ b/chainOfResponsibility/cashier.go @@ -3,14 +3,14 @@ package main import "fmt" type Cashier struct { - next Department + DepartmentBase } func (c *Cashier) execute(p *Patient) { if p.paymentDone { fmt.Println("Payment Done") } - fmt.Println("Cashier getting money from patient patient") + fmt.Println("Cashier getting money from patient:", p.name) } func (c *Cashier) setNext(next Department) { diff --git a/chainOfResponsibility/departmentBase.go b/chainOfResponsibility/departmentBase.go index a0f1e72..a42d1df 100644 --- a/chainOfResponsibility/departmentBase.go +++ b/chainOfResponsibility/departmentBase.go @@ -1,5 +1,5 @@ package main type DepartmentBase struct { - nextDepartment Department + next Department } diff --git a/chainOfResponsibility/doctor.go b/chainOfResponsibility/doctor.go index edf99a3..8ae4266 100644 --- a/chainOfResponsibility/doctor.go +++ b/chainOfResponsibility/doctor.go @@ -3,7 +3,7 @@ package main import "fmt" type Doctor struct { - next Department + DepartmentBase } func (d *Doctor) execute(p *Patient) { @@ -12,7 +12,7 @@ func (d *Doctor) execute(p *Patient) { d.next.execute(p) return } - fmt.Println("Doctor checking patient") + fmt.Println("Doctor checking patient:", p.name) p.doctorCheckUpDone = true d.next.execute(p) } diff --git a/chainOfResponsibility/medical.go b/chainOfResponsibility/medical.go index e255790..ae54112 100644 --- a/chainOfResponsibility/medical.go +++ b/chainOfResponsibility/medical.go @@ -3,16 +3,16 @@ package main import "fmt" type Medical struct { - next Department + DepartmentBase } func (m *Medical) execute(p *Patient) { if p.medicineDone { - fmt.Println("Medicine already given to patient") + fmt.Println("Medicine already given to patient:", p.name) m.next.execute(p) return } - fmt.Println("Medical giving medicine to patient") + fmt.Println("Medical giving medicine to patient:", p.name) p.medicineDone = true m.next.execute(p) } diff --git a/chainOfResponsibility/reception.go b/chainOfResponsibility/reception.go index e79a661..cd8c291 100644 --- a/chainOfResponsibility/reception.go +++ b/chainOfResponsibility/reception.go @@ -3,7 +3,7 @@ package main import "fmt" type Reception struct { - next Department + DepartmentBase } func (r *Reception) execute(p *Patient) { @@ -12,7 +12,7 @@ func (r *Reception) execute(p *Patient) { r.next.execute(p) return } - fmt.Println("Reception registering patient") + fmt.Println("Reception registering patient:", p.name) p.registrationDone = true r.next.execute(p) }