Skip to content

Commit 9a5dbca

Browse files
authored
Merge pull request Codecademy#6 from jekhi5/patch-1
Create HumanYears.swift
2 parents 2d96c9d + bd655c9 commit 9a5dbca

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Human Years
2+
//Jacob Kline
3+
//Much like the Dog Years program, this program only works when the human age is above the "underageYears" (21 years)
4+
5+
//This is the human's age stored as a double
6+
var humanAge: Double = 21.5
7+
8+
//This is how many dog years a human's "underage years" (first 21 years) are
9+
let underageYears: Double = 2
10+
11+
//This is how many dog years a human's "later years" make up (every year of their life except their first 21)
12+
let adultYears: Double = (humanAge - 21) / 4
13+
14+
//This is the total age of the human in dog years
15+
let dogYears: Double = underageYears + adultYears
16+
17+
print("My Name is Jacob! Hi hi, I am \(dogYears) years old in dog years.")

0 commit comments

Comments
 (0)