subject

Swift code

import foundation

protocol taksperformer {

func doathing()

}

class employee: taksperformer {

let name: string

var boss: boss?

init(name: string) {

self. name = name

}

func doathing() {

print("\(name) is doing a thing")

}

}

class boss {

var employee: employee

let name: string

init(name: string, employee: employee) {

self. name = name

self. employee = employee

employee. boss = self

}

func actlikeaboss() {

employee. doathing()

}

}

// 1)

// a) what is wrong with the current implementation of boss and employee, why is it wrong, and how can we demonstrate that there is an issue?

//

// b) what pattern discussed in class does the boss - employee relationship remind you of? give an example of the discussed pattern.

//

// c) create a person class that has the following property:

// let name: string

// now have employee and boss inherit from person

//

// d) you realize that there are speciffic tasks you would like an employee to perform. all tasks look like this:

// func makecoffe(_ name: string) {

// print("\(name) made coffe")

// }

//

// func writereport(_ name: string) {

// print("\(name) wrote a report")

// }

// modify boss, employee and taskperformer in a way that a boss can be instantiated with the following constructor:

// boss(name: "bossman", employee: anemployee, tasks: [makecoffe, writereport])

// the employee instance should perform the tasks.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
How can a user open a blank presentation? 1.on the file menu, click new, and then click recent templates 2.on the file menu, click new, and then click blank presentation 3. on the view menu, click templates, and then click recent templates 4. on the view menu, click samples, and then click blank presentation
Answers: 1
question
Computers and Technology, 24.06.2019 16:30
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject after the midsemester exams and the end-of-semester exams. she divides the midsemester and end-of-semester information into two separate worksheets, sheet 1 and sheet 2. how will she rename the two worksheets?
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
This assignment continues work on the online booking facility introduced at the end of chapter- 10. the work will be continued in the assignments for chapters 14 and 15 (a) assume that you will produce your online booking facility using an agile approach. i. suggest the kind of user research you would like to conduct for your product before iteration cycles begin. ii prioritize the requirements for your product according to business value, i.e which requirements are likely to provide the greatest business benefit, and sketch out the ux design work you would expect to undertake during the first four iteration cycles, i.e. cycle 0, and cycles 1 to 3. (b) using one of the mockup tools introduced above, generate a mockup of your product's landing page, as developed in the assignment for chapter-11 (c) using one of the patterns websites listed previously, identify suitable interaction patterns for elements of your product, and develop a software-based prototype that incorporates all the feedback and the results of the user experience mapping achieved at the end of chapter-11. if you do not have experience in using any of these, create a few html web pages to represent the basic structure of your website
Answers: 2
question
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
You know the right answer?
Swift code

import foundation

protocol taksperformer {

func do...
Questions
question
Mathematics, 24.04.2021 01:10
question
English, 24.04.2021 01:10
question
Mathematics, 24.04.2021 01:10
question
Mathematics, 24.04.2021 01:10
question
Mathematics, 24.04.2021 01:10
question
Social Studies, 24.04.2021 01:10
Questions on the website: 13722360