subject

Look at below code and respond all the requiredimport foundationprotocol taksperformer {func doathing()}class employee: taksperformer {let name: stringvar boss: boss? init(name: string) {self. name = name}func doathing() {print("\(name) is doing a thing")}}class boss {var employee: employeelet name: stringinit(name: string, employee: employee) {self. name = nameself. employee = employeeemployee. 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.// 2)// create a small app that takes user input and performs a useful calculation with that user input// - using techniques we learned in class, make sure that absolutely no input crashes the app.// - use layout constraints to make sure the app looks good in portraint and landscape mode, as well as on small and large devices.// - use mvc// - bonus: write unit tests for your model to make sure no input can crash the app.// 3) you created a bookshelf.// a) how could you modify shelve with a technique discussed in class so that you can create shelve instances that contain// tools, dishes or any other kind of object? // b) create a function that takes in two shelves of the same type and swaps their itemsstruct book {let title: string}struct shelve {var top: bookvar center: bookvar bottom: book}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:00, AngiT
Which spereadsheet type will determine how well a bussiness has done over the past year
Answers: 1
image
Computers and Technology, 23.06.2019 03:50, dondre54
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, kaylee2828
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
image
Computers and Technology, 23.06.2019 23:00, Maya629277
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a. add symmetry b. create a unified publication c. provide consistency d. save money
Answers: 1
You know the right answer?
Look at below code and respond all the requiredimport foundationprotocol taksperformer {func doathin...

Questions in other subjects:

Konu
Mathematics, 18.03.2021 03:20
Konu
Mathematics, 18.03.2021 03:20