diff --git a/.DS_Store b/.DS_Store index 072f462..1ca47b2 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/cw2.p1.playground/Contents.swift b/cw2.p1.playground/Contents.swift new file mode 100644 index 0000000..08d93b5 --- /dev/null +++ b/cw2.p1.playground/Contents.swift @@ -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]) + diff --git a/cw2.p1.playground/contents.xcplayground b/cw2.p1.playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/cw2.p1.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/cw2.p2.playground/Contents.swift b/cw2.p2.playground/Contents.swift new file mode 100644 index 0000000..b44a6cd --- /dev/null +++ b/cw2.p2.playground/Contents.swift @@ -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) + + diff --git a/cw2.p2.playground/contents.xcplayground b/cw2.p2.playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/cw2.p2.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/cw2.p3.playground/Contents.swift b/cw2.p3.playground/Contents.swift new file mode 100644 index 0000000..1f09df7 --- /dev/null +++ b/cw2.p3.playground/Contents.swift @@ -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("راسب") +} diff --git a/cw2.p3.playground/contents.xcplayground b/cw2.p3.playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/cw2.p3.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/iOSClasswork2/iOSClasswork2.xcodeproj/project.xcworkspace/xcuserdata/f7n.xcuserdatad/UserInterfaceState.xcuserstate b/iOSClasswork2/iOSClasswork2.xcodeproj/project.xcworkspace/xcuserdata/f7n.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..8bf87a7 Binary files /dev/null and b/iOSClasswork2/iOSClasswork2.xcodeproj/project.xcworkspace/xcuserdata/f7n.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iOSClasswork2/iOSClasswork2.xcodeproj/xcuserdata/f7n.xcuserdatad/xcschemes/xcschememanagement.plist b/iOSClasswork2/iOSClasswork2.xcodeproj/xcuserdata/f7n.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..85fbfe9 --- /dev/null +++ b/iOSClasswork2/iOSClasswork2.xcodeproj/xcuserdata/f7n.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + iOSClasswork2.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/iOSClasswork2/iOSClasswork2/ViewController.swift b/iOSClasswork2/iOSClasswork2/ViewController.swift index 6aed9f9..de51bba 100644 --- a/iOSClasswork2/iOSClasswork2/ViewController.swift +++ b/iOSClasswork2/iOSClasswork2/ViewController.swift @@ -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 = "" } @@ -38,7 +57,7 @@ class ViewController: UIViewController { animalEmojiLabel.text! += label } /// **BONUS**: 🎁 قم بمسح مكونات المصفوفة بعد عرضها - + emojiArray.removeAll() } }