Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quadratic.swift Calculator program #32

Open
wants to merge 68 commits into
base: kl-new-array-projs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
b61c5de
Update Monkeys.swift
adistasicc Feb 6, 2020
3f9afdd
Update and rename Monkeys.swift to FiveLittleMonkeys.swift
adistasicc Feb 7, 2020
f54b445
Merge pull request #2 from Codecademy/kl-new-array-projs
LinKCoding Feb 7, 2020
761f789
Update Palindrome.swift
sonnynomnom Feb 7, 2020
f8d7d6c
Update README.md
sonnynomnom Feb 8, 2020
649bd2b
Update Bottles.swift
adistasicc Feb 10, 2020
6962c0e
Update README.md
sonnynomnom Feb 12, 2020
965d98c
Update README.md
sonnynomnom Feb 12, 2020
8958fa3
Update README.md
sonnynomnom Feb 12, 2020
f664418
Update README.md
sonnynomnom Feb 12, 2020
10d4c59
Update README.md
sonnynomnom Feb 12, 2020
9627019
Update README.md
sonnynomnom Feb 12, 2020
9a51892
Update FizzBuzz.swift
sonnynomnom Feb 12, 2020
52a8e63
Update README.md
sonnynomnom Feb 12, 2020
f0fdd5f
Update PiggyBank.swift
sonnynomnom Feb 12, 2020
feadd28
Update Quadratic.swift
sonnynomnom Feb 12, 2020
5cba591
Update DogYears.swift
sonnynomnom Feb 12, 2020
f6d9151
Update WhaleTalk.swift
sonnynomnom Feb 12, 2020
6dc0f2d
Update AwesomeMixVol1.swift
sonnynomnom Feb 12, 2020
34f545e
Update Taylor.swift
sonnynomnom Feb 12, 2020
7ac987a
Update CaesarCipher.swift
sonnynomnom Feb 12, 2020
a669a66
Update Palindrome.swift
sonnynomnom Feb 12, 2020
bafc539
Update Palindrome.swift
sonnynomnom Feb 12, 2020
acb9ad1
Update FizzBuzz.swift
sonnynomnom Feb 12, 2020
9d241c8
Update Temperature.swift
sonnynomnom Feb 12, 2020
8d9ec50
Update BMI.swift
sonnynomnom Feb 12, 2020
b5dbd4c
Update BMI.swift
sonnynomnom Feb 12, 2020
9752fd4
Update README.md
sonnynomnom Feb 12, 2020
843f7d7
Moved file
adistasicc Feb 12, 2020
874cc63
Update README.md
sonnynomnom Feb 12, 2020
af6971d
Delete Bottles.swift
sonnynomnom Feb 12, 2020
d8a4b48
Create Bottles.swift
sonnynomnom Feb 12, 2020
f066358
Update README.md
sonnynomnom Feb 12, 2020
cf68d66
Update FiveLittleMonkeys.swift
sonnynomnom Feb 12, 2020
4ed6515
Add new files
sonnynomnom Feb 12, 2020
ecf8f05
Update README.md
sonnynomnom Feb 12, 2020
f84b4a1
Merge branch 'master' of https://github.com/Codecademy/learn-swift
sonnynomnom Feb 12, 2020
8e30f84
Update README.md
sonnynomnom Feb 12, 2020
105ef5f
Update
sonnynomnom Feb 12, 2020
a2bebac
Update README.md
sonnynomnom Feb 12, 2020
f88c943
Update README.md
sonnynomnom Feb 12, 2020
03fe123
Update README.md
sonnynomnom Feb 12, 2020
2240d13
updates
sonnynomnom Feb 26, 2020
5ff90a3
Update README.md
sonnynomnom Feb 27, 2020
35c3f49
initial solutions
LinKCoding Mar 2, 2020
e1340a7
added comments to explain code
LinKCoding Mar 2, 2020
748e083
Merge pull request #3 from Codecademy/kl-add-FS-loops-review
LinKCoding Mar 2, 2020
03e582a
Create Morse.swift
adistasicc Mar 9, 2020
944a0ca
Create
SSJASIAN Mar 19, 2020
1c81bfb
Update README.md
sonnynomnom Mar 20, 2020
f2743ed
Renamed folder
adistasicc Mar 23, 2020
1677acf
Added Roster.swift
adistasicc Mar 23, 2020
f15722b
added first half
LinKCoding Mar 25, 2020
192ad41
revised directory name
LinKCoding Mar 25, 2020
cb7adea
added second half of project
LinKCoding Mar 25, 2020
2f829b3
Merge pull request #5 from Codecademy/kl-structs
LinKCoding Mar 25, 2020
3984854
Update Morse.swift
adistasicc Mar 27, 2020
1bff082
Merge pull request #4 from Adriano-Lance-2873/master
sonnynomnom Mar 28, 2020
6808881
Update Newlines.swift
sonnynomnom Mar 28, 2020
78e23e1
updated and renamed project sol code
LinKCoding Mar 31, 2020
7b992e6
Add functions project solution
galinap684 Apr 1, 2020
c3cf9d2
update
sonnynomnom Apr 2, 2020
9cb8c0d
Update Pokedex.swift
sonnynomnom Apr 2, 2020
7c38e15
Update Pokedex.swift
sonnynomnom Apr 3, 2020
2d96c9d
Create swift-team.jpg
sonnynomnom Apr 27, 2020
bd655c9
Create HumanYears.swift
jekhi5 May 19, 2020
9a5dbca
Merge pull request #6 from jekhi5/patch-1
sonnynomnom May 27, 2020
d02a829
Update README.md
CATower Oct 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed 1-hello-world/art/bjarne.gif
Binary file not shown.
Binary file removed 1-hello-world/art/bjarne2.gif
Binary file not shown.
Binary file removed 1-hello-world/art/compiler.png
Binary file not shown.
Binary file removed 1-hello-world/art/file-name.png
Binary file not shown.
Binary file removed 1-hello-world/art/files1.png
Binary file not shown.
Binary file removed 1-hello-world/art/files2.png
Binary file not shown.
Binary file added 1-hello-world/art/introduction.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
202 changes: 0 additions & 202 deletions 1-hello-world/art/process.svg

This file was deleted.

Binary file removed 1-hello-world/art/program-structure.png
Binary file not shown.
4 changes: 4 additions & 0 deletions 1-hello-world/block-letters/Newlines.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Lance Adriano
// Fun fact: I skipped third grade.

print("L A\nL A A\nL A A\nL AAAAA\nL A A\nL A A\nLLLLL A A")
3 changes: 3 additions & 0 deletions 2-variables/BMI.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Body Mass Index 🏋️‍
// Sonny Li

var height: Double = 1.85
var weight: Double = 82
var bmi: Double
Expand Down
3 changes: 3 additions & 0 deletions 2-variables/Temperature.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Temperature 🌡️
// Sonny Li

var tempf: Double = 83.0
var tempc: Double = 0.0

Expand Down
Binary file removed 2-variables/art/compiler.png
Binary file not shown.
Binary file removed 2-variables/art/folder-icon.png
Binary file not shown.
6 changes: 0 additions & 6 deletions 2-variables/art/folder-icon.svg

This file was deleted.

Binary file removed 2-variables/art/process-quiz.png
Binary file not shown.
Binary file removed 2-variables/art/process.gif
Binary file not shown.
202 changes: 0 additions & 202 deletions 2-variables/art/process.svg

This file was deleted.

Binary file removed 2-variables/art/program-structure.png
Binary file not shown.
Binary file removed 2-variables/art/terminal.png
Binary file not shown.
2 changes: 1 addition & 1 deletion 2-variables/dog-years/DogYears.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Dog Years (Swift)
// Dog Years 🐶
// Sonny Li

var dogAge: Double = 2.5
Expand Down
17 changes: 17 additions & 0 deletions 2-variables/dog-years/HumanYears.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//Human Years
//Jacob Kline
//Much like the Dog Years program, this program only works when the human age is above the "underageYears" (21 years)

//This is the human's age stored as a double
var humanAge: Double = 21.5

//This is how many dog years a human's "underage years" (first 21 years) are
let underageYears: Double = 2

//This is how many dog years a human's "later years" make up (every year of their life except their first 21)
let adultYears: Double = (humanAge - 21) / 4

//This is the total age of the human in dog years
let dogYears: Double = underageYears + adultYears

print("My Name is Jacob! Hi hi, I am \(dogYears) years old in dog years.")
2 changes: 1 addition & 1 deletion 2-variables/piggy-bank/PiggyBank.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Piggy Bank (Swift)
// Piggy Bank 🐽
// Sonny Li

var pesos: Double = 4
Expand Down
2 changes: 1 addition & 1 deletion 2-variables/quadratic-formula/Quadratic.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Quadratic Formula (Swift)
// Quadratic Formula 📈
// Sonny Li

var a: Double = 6
Expand Down
Binary file added 2-variables/types.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3-conditionals/donut_factory.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 0 additions & 34 deletions 3-conditionals/magic-8-ball/ChallengeSolution.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Magic 8-Ball 🎱
// Galina Podstrechnaya

let playerName = "Galina"

let playerQuestion = "Will there be any more snowfall in New York for winter 2020? ❄️"
Expand Down Expand Up @@ -31,4 +34,8 @@ switch randomNumber {
}

print("\(playerName)'s Question: \(playerQuestion)")
print("Magic 8 Ball's answer: \(eightBall)")

// Challenge:
// playerName.isEmpty ? print("Question: \(playerQuestion)") : print("\(playerName) asks: \(playerQuestion)")

print("Magic 8 Ball's answer: \(eightBall)")
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Bottles (Swift) - Prints the full lyrics to "99 Bottles of Milk" song
// Alex DiStasi

//numBottles represents the number of bottles left on the wall
// numBottles represents the number of bottles left on the wall
var numBottles: Int = 99

//While there are more than 0 bottles on the wall, print the song lyrics
// While there are more than 0 bottles on the wall, print the song lyrics
while numBottles > 0 {

print ("\(numBottles) bottles of milk on the wall, \(numBottles) bottles of milk!")
Expand All @@ -17,6 +17,17 @@ while numBottles > 0 {

print ("\(numBottles) bottles of milk on the wall, \(numBottles) bottles of milk!\nGo to the store and buy some more,\n99 bottles of milk on the wall!")

/*
// Solution to optional challenge 1

for numBottles in stride(from: 99, to: 0, by: -1){
print ("\(numBottles) bottles of milk on the wall, \(numBottles) bottles of milk!")
print ("You take one down and pass it around...")
print ("\(numBottles-1) bottles of milk on the wall!")
}

print ("0 bottles of milk on the wall, 0 bottles of milk!\nGo to the store and buy some more,\n99 bottles of milk on the wall!")

*/


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Monkeys.swift
// Five Little Monkeys 🐵🙉🙊🙈🐒
// Alex DiStasi
// Purpose: Prints the lyrics to Five Little Monkeys song

Expand All @@ -11,12 +11,11 @@ while numMonkeys > 1 {
print ("One fell off and bumped their head!")
print ("Mama called the doctor and the doctor said")
print ("'No more monkeys jumping on the bed!'\n")
// Decrease the value of numMonkeys by 1
numMonkeys -= 1
}

// Print the final lyrics
print ("\(numMonkeys) little monkey jumping on the bed.")
print ("They fell off bumped their head!")
print ("They fell off and bumped their head!")
print ("Mama called the doctor and the doctor said")
print ("'Put those monkeys straight to bed!'")
48 changes: 48 additions & 0 deletions 4-loops/Review.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Test your 🔁 skills!

// First challenge:
for num in 1...100 {
// If a number is fully divisible by 2, it's an even number
if num % 2 == 0 {
print("even")
} else {
print("odd")
}
}


// Second Challenge
// checkPrime can be changed to a positive number greater than 1
var checkPrime = 17
// Assume the number is prime until proven otherwise
var isPrime = true
for num in 2...checkPrime - 1 {
// If checkPrime is fully divisible by the current number it's not a prime number
if checkPrime % num == 0 {
isPrime = false
break
}
}

print("Is \(checkPrime) a prime numer? \(isPrime)!")


// Third Challenge
var counter = 0
for _ in "What is this a string for ants?" {
counter += 1
}

print("There are \(counter) characters in that string!")


// Fourth Challenge
// use starTracker to store the # of *s
var starTracker = ""
// stopNum controls when to stop the loop
var stopNum = 4

for _ in 1...stopNum {
starTracker += "*"
print(starTracker)
}
9 changes: 5 additions & 4 deletions 4-loops/fizzbuzz/FizzBuzz.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Fizz Buzz 🐝
// Kenny Lin
// Solutions for FizzBuzz

// while loop:
// Using a while loop:
var counter = 1

while counter <= 100 {
// Could also do: counter % 15 == 0
if counter % 3 == 0 && counter % 5 == 0 {
Expand All @@ -17,7 +18,7 @@ while counter <= 100 {
counter += 1
}

// for-in loop:
// Using a for-in loop:
for num in 1...100 {
// Could also do: num % 15 == 0
if num % 3 == 0 && num % 5 == 0 {
Expand Down Expand Up @@ -71,4 +72,4 @@ for num in 1...500 {
print(num)
}
}
*/
*/
6 changes: 2 additions & 4 deletions 4-loops/whale-talk/WhaleTalk.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Whale Talk 🐋
// Kenny Lin
// Solution for Whale Talk

// Create your Whale Talk program below:

var input = "I know not all that may be coming, but be it what it will, I'll go to it laughing. -Moby Dick"
var input = "I know not all that may be coming, but be it what it will, I'll go to it laughing. - Moby Dick"

var output = ""

Expand Down
Binary file added 4-loops/whale-talk/whale_talk.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions 5-arrays-and-sets/DNA.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// DNA Sequencing 🧬
// Sonny Li

var dna = ["ATG", "ACG", "GAA", "TAT"]

dna.insert("GTG", at: 3)
dna.remove(at: 0)

print(dna)
11 changes: 11 additions & 0 deletions 5-arrays-and-sets/NewYearNewMe.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// New Year Resolutions 💪
// Sonny Li

var resolutions = ["play more music 🎸",
"read more books 📚",
"drink more water 💧"]

resolutions.append("cook more food 🍝")
resolutions += ["save more money 💰"]

print(resolutions)
14 changes: 14 additions & 0 deletions 5-arrays-and-sets/RetailTherapy.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Receipt 🧾
// Sonny Li

var receipt = [12.00, 3.75, 6.50, 19.99]

var total: Double = 0.0

for item in receipt {
total += item
}

total *= 1.08875

print(total)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Caesar Cipher (Swift)
// Caesar Cipher 🏛
// Sonny Li

var alphabet: [Character] = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Make a Mixtape 101 📻
// Make a Mixtape 101 📼
// Sonny Li

print(".------------------------. ")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Make a Mixtape 101 📼
// Sonny Li

print(".------------------------.")
print("| Tay Tay's Ultimate Mix |")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
// Palindrome
// Palindrome 💬
// Sonny Li

var text = ["h", "e", "l", "l", "o"]

var reversed = [String]()

var counter = text.count - 1

while(counter >= 0) {

while counter >= 0 {
reversed.append(text[counter])
counter = counter - 1

}

if (text == reversed) {

if text == reversed {
print("We have a palindrome!")

} else {

print("\(text) is not palindrome.")

}
Loading