From 6dd2ea22f40c31836255676f1d37e2a3ac2a3786 Mon Sep 17 00:00:00 2001 From: davethai Date: Mon, 26 Nov 2018 17:54:42 -0500 Subject: [PATCH] Completed Questions --- .../Pages/main.xcplaygroundpage/Contents.swift | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift index ebe55fd..cfb6473 100644 --- a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -14,7 +14,7 @@ /*: question1 ### 1. Create a variable which represents your bank account balance. (For example: What is a good name for this variable that makes it easily readable for myself now and for the future me _or_ other developers I might be working with? Should I declare it using `let` or `var`? Should it be of type `Int` or `String`?) */ -// write your code here +var balance = 10000 @@ -22,15 +22,14 @@ /*: question2 ### 2. You went to your local pet store and purchased yourself a puppy. You decided to name the puppy Bella. Once you named her, that name will stick with her forever. Create a variable that stores the name of your new puppy. */ -// write your code here - +let puppyName = "Bella" /*: question3 ### 3. Use the `print()` function to print the name of your new puppy to the console. */ -// write your code here +print(puppyName) @@ -38,7 +37,7 @@ /*: question4 ### 4. Use the `print()` function to print the sentence "I just got a new puppy named and she is awesome!" to the console. */ -// write your code here +print("I just got a new puppy named \(puppyName) and she is awesome!") @@ -46,7 +45,7 @@ /*: question5 ### 5. Use the `print()` function to print the sentence "I have $ in my bank account." to the console. */ -// write your code here +print("I have $\(balance) in my bank account.") @@ -54,7 +53,8 @@ /*: question6 ### 6. Congratulations! You just got $100 for your birthday, so now you have $100 more in your bank account. Update your bank account with the new balance and print "I now have $." to the console. */ -// write your code here +balance = balance + 100 +print("I now have $\(balance).") @@ -62,7 +62,7 @@ /*: question7 ### 7. You decided you don't like the name Bella. Change your puppy's name to something else. (Can you do this? What happens when you try? Why?) */ -// write your code here +puppyName = "Archer" /*: @@ -70,3 +70,4 @@ */ +