Ios in swift paper

Department of Computer Science and Information Technology Sarhad University, Peshawar

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Name:Wasim wahid

Reg no:SU-17-01-002-123

Section:”c”

Email:wasimwahid.nba@gmail.com

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Final Term Examination

Subject: IOS MAC APPLICATION DEVELOPEMENT marks:50

Semester:7th time:24 hrs

NOTE: Attempt all questions

Question 1: (6)
1. Consider the following code:

struct Lesson {
var difficulty: Int = 1
}
var Lesson1 = Lesson()
var Lesson2 = tutorial1
Lesson2.difficulty = 2

What are the values of lesson1.difficulty and lesson2.difficuilty?

Would this be any different if lesson was a classs? Why or why not explain with your answer.

2. This code creates two classes company and address. It than creates two company instances IT and marketing.

class Address {
var fullAddress: String
var city: String

init(fullAddress: String, city: String) {
self.fullAddress = fullAddress
self.city = city
}
}
class Company {
var name: String
var address: Address

init(name: String, address: Address) {
self.name = name
self.address = address
}
}
var headquarters = Address(fullAddress: “123 Tutorial Street”, city: “Appletown”)
var IT = Company(name: “IT solutions”, address: headquarters)
var Marketing = Company(name: “ATV Marketing”,address: headquarters)
Suppose Marketing company moves to the new building across the street; you’ll want to update his record like this:
brian.address.fullAddress = “148 Tutorial Street”
This compiles and runs without error. If you check the address of IT comapny now, it is also moved to the new building

print(IT.address.fullAddress)

What’s going on here? How can you fix the problem?
Give a suitable solution for this.
(4)
Part b:

Write a swift class to produce invoice from customer number, customer name, customer address, date of sale, item no, item description, quantity sold, unit price of item, discount percentage and sales tax percentage. Use your own formulas for calculation of total price or tax rate etc.
Question no 2

Part 1 (8)
1. Spot the error and explain the error as well

func Exercise(_ repeat: Int, type: String) -> Int {
var output: String = “”
for _ in 0 ..< repeat { output += "I'm doing a \(type)\n" } if repeat < 10 { output += "That was easy!" } else if repeat < 30 { output += "That was challenging!" } else { output += "Phew - I need a break!" } return output } print(Exercise(repeat: 34, type: "push up")) 2. func shareWinnings(people: Int, fairly: Bool) -> String {
var returnValue: String = “We’re going to split this…\n’
if fairly {
returnValue += “Everyone gets 1/\(people)”
} else {
returnValue +=”I get half because I deserve it.\n”
returnValue += “Everyone else can split the remainder.”
}
return returnValue
print(shareWinnings(people: 3, fairly: true))}

1) Rearrange the line of code

struct XWing {
if callSign == “Red 5”
{
return false
var callSign: String
}
{
return true
else {

}
func shouldAttackDeathStar() -> Bool
}
}

2) Rearrange the code

if number % 2 == 0 {
for number in numbers {
}
print(number)
var numbers = [1, 2, 3, 4, 5, 6]
}
} else {
print(“Skipping odd number”)

part: b

Q: Write a note on the following also give examples.
· UINavigationController
·  UITabBarController
· UISplitViewController
(2)
Question no 3
1. Create a function fetchUserEmail and send the userID as parameter. Create 8 users and check the id with its email. Print the email when the id matches.
(5)

2. Create a program and give options to user to display student record.
user selects A The program should display names of 10 students,
user selects B The program should display gpa of 10 students,
user selects C The program should display name, gpa & roll no of 10 students. (use structures).
Select the student with highest gpa and display it as
The topper of class is: name with gpa of “ ”
(5)
Question 4

a) Create a program for a reader. If the reader enters page number of a book the program will show page number along with title of the page where

Page1: contents of book
Page2-4: introduction
Page4: chapter 1
Page30: chapter 2
Page31: chapter 2 swift tutorials
Page40-150: main title: tutorials and second title tutorial number (page 40-50 tutorial 1, page 51-85 tutorial 2, page 86-120 tutorial 3 & page 120-150 tutorial 4)
(main heading: “swift programming tutorials”)
(sub heading: “tutorial 1”)
(5)
b) Consider the above question of book. Print 100 copies of that book as well and set the name of the book and author name of the book as:
Book title: swift for “beginners” , book author: “paul”

(5)
Question no 5

Part a:

Implement the concept of inheritance. Create 3 classes department, telecom and software.

Department has class members: chairman (string), (string func) welcome, students(int)

Telecom has member: batches (bool)

Software has member: semester (int)

Display the following output by using above knowledge

Welcome to telecom department
Chairman of telecom department is ali shahzad
There are 300 students in telecom department
Telecom department has 5 graduate batches true
Welcome to software department
Chairman of software department is Hamza shah
There are 100 students in software department 8th semester.

(7)

Part b: (3)
1. Summarize main difference between classes and structures with help of an example?

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP