diff --git a/03week/index.html b/03week/index.html new file mode 100644 index 000000000..46f9a6305 --- /dev/null +++ b/03week/index.html @@ -0,0 +1,19 @@ + + + + + + Pig Latin + + + + + +

Learn a New Language Fast!

+
+ + +
 
+ + + \ No newline at end of file diff --git a/03week/pigLatin-GUI.js b/03week/pigLatin-GUI.js new file mode 100644 index 000000000..0207e1534 --- /dev/null +++ b/03week/pigLatin-GUI.js @@ -0,0 +1,37 @@ +'use strict'; +// const assert = require('assert'); +// const readline = require('readline'); +// const rl = readline.createInterface({ +// input: process.stdin, +// output: process.stdout +// }); + +function pigLatin() { + //remove whitespace and change to lower case + let word = document.getElementById("input").value; + word = word.trim().toLowerCase(); + let newWord = word.split(""); + let final; + + const vowel = ['a','e','i','o','u']; + if (vowel.includes(word.charAt(0))) { + final = word + 'way'; + document.getElementById("translator").innerHTML = final; + } else { + for (let i=0; i < newWord.length; i++){ + if (!vowel.includes(word[i])) { + newWord.push(newWord.shift()); + } else if (vowel.includes(word[i])){ + newWord.push('ay'); + final = newWord.join(''); + document.getElementById("translator").innerHTML = final; + return final; + } + } + } + // document.getElementById("translator").innerHTML = final; + } + + function returnWord() { + document.getElementById("translator").innerHTML = pigLatin(); + } \ No newline at end of file diff --git a/03week/style.css b/03week/style.css new file mode 100644 index 000000000..d3fc575e6 --- /dev/null +++ b/03week/style.css @@ -0,0 +1,65 @@ +* { + box-sizing: border-box; +} + +body { + background-color: #a86ebe; +} + +h1 { + color: white; + font-size: 4em; + line-height: .7em; + padding-top: 30px; + padding-bottom: 20px; + margin: 0 auto; + text-align: center; + font-family: 'Gochi Hand', cursive; +} + +#bar { + background-color: white; + height: 4px; + width: auto; + border-radius: 5px; + margin-bottom: 10px; +} +#translator { + color: white; + background-color: #82439b; + display: flex; + flex-direction: column; + justify-content: center; + width: 300px; + height: 3em; + text-align: center; + font-family: 'Gochi Hand', cursive; + font-size: 3em; + margin: 60px auto 20px auto; + border-radius: 10px; +} + +input { + display: block; + margin: 0 auto; + text-align: center; + font-family: 'Fredoka One', cursive; + height: 2em; + font-size: 1.5em; + margin-bottom: 20px; + width: 300px; +} + +button { + display: block; + margin: 0 auto 10px auto; + height: 50px; + width: 200px; + font-size: 2em; + font-family: 'Fredoka One', cursive; + color: white; + background-color: #535166; + padding: 5px; + border: none; + border-radius: 10px; +} \ No newline at end of file