diff --git a/generatorFeature(v2) .playground/Contents.swift b/generatorFeature(v2) .playground/Contents.swift new file mode 100644 index 0000000..e744ec0 --- /dev/null +++ b/generatorFeature(v2) .playground/Contents.swift @@ -0,0 +1,74 @@ +import UIKit + +//create an dictionary containing exercises and their calories + +var exercises = [11:"Jumping Jacks", 12: "Jogging", 10: "Cycling", 5: "Squats", 9: "Skipping"] +var key = [11,12,10,5,9] + + + + + +// Generate a workout that equals the target calorie +var user = 3000 +var a = user/2 +let b = a / 2 +let c = b +let d = 0 + +//ARRAY OF ALL EXERCISES +var aList = [String]() + + +//EXERCISES AND REPS +var cycling1 = 0 +var squats1 = 0 +var skipping1 = 0 +var jumpingJacks1 = 0 +var jogging1 = 0 + + + + + +//CREATING A NEW WORKOUT PLAN + +//DAY 1 -> CREATING A LIST OF ALL EXERCISES IN PLAN A +while (a >= 0) { + + //generating a random key + var randKey = Int.random(in: 0..<5) + randKey = key[randKey] + + //adding the random exercise onto new list + aList.append(exercises[randKey]!) + a = a - randKey + print(a) +} + + + +for counter in 0...aList.count - 1{ + + let exercise = aList[counter] + switch exercise{ + case "Cycling": + cycling1 += 1 + case "Squats": + squats1 += 1 + case "Skipping": + skipping1 += 1 + case "Jumping Jacks": + jumpingJacks1 += 1 + case "Jogging": + jogging1 += 1 + default: + print("no exercise present") + } +} +print("Cycling FOR \(cycling1) MINS ") +print("Squats FOR \(squats1) MINS ") +print("Skipping FOR \(skipping1) MINS ") +print("Jumping Jacks FOR \(jumpingJacks1) MINS ") +print("Jogging FOR \(jogging1) MINS ") + diff --git a/generatorFeature(v2) .playground/contents.xcplayground b/generatorFeature(v2) .playground/contents.xcplayground new file mode 100644 index 0000000..5da2641 --- /dev/null +++ b/generatorFeature(v2) .playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file