Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions cw2.p1.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let family = ["Abdullatif", "Faisal", "Saleh"]

var evens = [2, 4, 6, 8, 10, 12,]

var grades = [97.2, 93.7, 91.0]

var trueFalse = [true, false, true, true]

print(family[0], family[2])
print(evens[0], evens[5])
print(grades[0], grades[2])
print(trueFalse[0], trueFalse[3])

4 changes: 4 additions & 0 deletions cw2.p1.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>
17 changes: 17 additions & 0 deletions cw2.p2.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var fruits = ["Mango", "Orange", "Potato", "Peach"]
print(fruits[0]
print(fruits[3])

print(fruits)

fruits.append("strawberry")
print(fruits)
fruits.remove(at: 2)

print(fruits)
fruits += ["Banana", "Watermelon", "pineaple", "kiwi"]
print(fruits)
fruites
print(fruits)


4 changes: 4 additions & 0 deletions cw2.p2.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>
31 changes: 31 additions & 0 deletions cw2.p3.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var grades = [90.3, 83.92, 90.4]
let average = (grades[0] + grades[1] + grades[2]) / 3

if average >= 90{
print("ممتاز")
}
else if average >= 80{
print("جيد جدا")
}
else if average >= 70{
print("جيد")
}
else{
print("راسب")
}
grades.remove(at: 1)

let average2 = (grades[0] + grades[1])/2

if average2 >= 90{
print("ممتاز")
}
else if average2 >= 80{
print("جيد جدا")
}
else if average2 >= 70{
print("جيد")
}
else{
print("راسب")
}
4 changes: 4 additions & 0 deletions cw2.p3.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>iOSClasswork2.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
25 changes: 22 additions & 3 deletions iOSClasswork2/iOSClasswork2/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,27 @@ class ViewController: UIViewController {


// MARK: - اكتب ال if statement الكود تحت


if animal == "cat"{
emojiArray.append("😸")
}
else if animal == "panda"{
emojiArray.append("🐼")
}
else if animal == "dog"{
emojiArray.append("🐶")
}
else if animal == "zebra"{
emojiArray.append("🦓")
}
else if animal == "lion"{
emojiArray.append("🦁")
}
else if animal == "shark"{
emojiArray.append("🦈")
}
else{
emojiArray.append("❓")
}
// MARK: - لا تقم بتغيير هذا السطر⚠️⚠️
animalTextField.text = ""
}
Expand All @@ -38,7 +57,7 @@ class ViewController: UIViewController {
animalEmojiLabel.text! += label
}
/// **BONUS**: 🎁 قم بمسح مكونات المصفوفة بعد عرضها

emojiArray.removeAll()
}
}