Ios in swift paper

Department of Computer Science and Information Technology Sarhad University, Peshawar

Name:Wasim wahid

Don't use plagiarized sources. Get Your Custom Essay on
Ios in swift paper
Just from $13/Page
Order Essay

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

Section:”c”

Email:wasimwahid.nba@gmail.com

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?

What Will You Get?

We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.

Premium Quality

Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.

Experienced Writers

Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.

On-Time Delivery

Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.

24/7 Customer Support

Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.

Complete Confidentiality

Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.

Authentic Sources

We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.

Moneyback Guarantee

Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.

Order Tracking

You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.

image

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

image

Trusted Partner of 9650+ Students for Writing

From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.

Preferred Writer

Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.

Grammar Check Report

Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.

One Page Summary

You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.

Plagiarism Report

You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.

Free Features $66FREE

  • Most Qualified Writer $10FREE
  • Plagiarism Scan Report $10FREE
  • Unlimited Revisions $08FREE
  • Paper Formatting $05FREE
  • Cover Page $05FREE
  • Referencing & Bibliography $10FREE
  • Dedicated User Area $08FREE
  • 24/7 Order Tracking $05FREE
  • Periodic Email Alerts $05FREE
image

Our Services

Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.

  • On-time Delivery
  • 24/7 Order Tracking
  • Access to Authentic Sources
Academic Writing

We create perfect papers according to the guidelines.

Professional Editing

We seamlessly edit out errors from your papers.

Thorough Proofreading

We thoroughly read your final draft to identify errors.

image

Delegate Your Challenging Writing Tasks to Experienced Professionals

Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!

Check Out Our Sample Work

Dedication. Quality. Commitment. Punctuality

Categories
All samples
Essay (any type)
Essay (any type)
The Value of a Nursing Degree
Undergrad. (yrs 3-4)
Nursing
2
View this sample

It May Not Be Much, but It’s Honest Work!

Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.

0+

Happy Clients

0+

Words Written This Week

0+

Ongoing Orders

0%

Customer Satisfaction Rate
image

Process as Fine as Brewed Coffee

We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.

See How We Helped 9000+ Students Achieve Success

image

We Analyze Your Problem and Offer Customized Writing

We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.

  • Clear elicitation of your requirements.
  • Customized writing as per your needs.

We Mirror Your Guidelines to Deliver Quality Services

We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.

  • Proactive analysis of your writing.
  • Active communication to understand requirements.
image
image

We Handle Your Writing Tasks to Ensure Excellent Grades

We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.

  • Thorough research and analysis for every order.
  • Deliverance of reliable writing service to improve your grades.
Place an Order Start Chat Now
image

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