Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |