diff --git a/.gitignore b/.gitignore index ed9495781..2973ab0b9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ npm-debug.log* # OS artifacts *.DS_Store +.idea \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 000000000..84275487e --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..51d8ad662 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + false + true + true + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + ECMAScript 6 migration aidsJavaScript + + + GeneralJavaScript + + + JavaScript + + + + + AngularJS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1507254634169 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/01week/datatypes.js b/01week/datatypes.js index e69de29bb..b603a0d81 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -0,0 +1,122 @@ +// Student: Jon Gorman +// Class: 211 Java Tue/Thur +// Instructor: Renee Dudley +// Date: 10/04/17 +//Revision Date: 10/11/17 + + +//Please let me know what to fix if its not too late. :) +'use strict'; + + + +//****create a function that returns the date and time +//variable that displays the day. +//variable that displays the time. +// variable that adds the day and the time. +//return the variable of the added date and time. + +const dayAndTime = () => { + let date = new Date(); + let n = date.toDateString(); + let time = date.toLocaleTimeString(); + return date + '' + time; +}; dayAndTime(); + +//_____________________________________________________ + +//****Write a JavaScript program to convert a number to a string. +//create a variable that is a number. +//create a variable that is number.numToString(); +//console.log the variable that equals .numToString; +//varify by adding the strings to get a souble string; + +const numStr = (peach) => { + return peach.toString(); +}; numStr(444); + +// ______________________________________________________ + +//****Write a JavaScript program to convert a string to the number. +//write a variable that is a string. +//write a variable the turns the string to a number with parseInt(). +//console.log the variable that used parseInt. + +const strNum = () => { + return parseInt('777'); +}; strNum(); + +//______________________________________________________ + +//****Write a JavaScript program that takes in different datatypes and prints out whether they are a: +//Boolean +//Null +//Undefined +//Number +//NaN +//String +//Use console.log(typeof...) for each one of the operators + +const returnType = () => { + return [typeof true, typeof 0/0, typeof null, typeof a, typeof 27, typeof 's-tring', 7/0, ]; +}; returnType(); + +//________________________________________________________ + +//****Write a JavaScript program that adds 2 numbers together. +//write a variable that equals a number +//write another variable that equals another number. +//console.log the addition of both variables + +const adding = (a, b) =>{ + return a + b +}; adding(7, 7); + +// __________________________________________________________ + +//****Write a JavaScript program that runs only when 2 things are true. +//create a function +//create variable that equals true +//create another variable that equals true +//use an if statement telling program what to console.log('true') if the varaibles are true +//use blank else statement so the function sudo-stops. +//call the function +// + +const happiness = (pizza, beer) => { + if(pizza === 'hot' && beer === 'cold'){ + return true; + } +}; happiness('hot', 'cold'); + +//________________________________________________________________ + +//****Write a JavaScript program that runs when 1 of 2 things are true. +//create a function +//create variable that equals true or false +//create another variable that equals true or false +//use an if statement telling program what to console.log('true') if both of the varaibles are false +//use blank else statement so the function sudo-stops. +//call the function + +const kindaHappy = (pizza, beer) => { + if(pizza === 'hot' || beer === 'cold'){ + return true; + } +}; kindaHappy('roomTemp', 'cold'); + +//__________________________________________________________ + +//Write a JavaScript program that runs when both things are not true +//create a function +//create variable that equals false +//create another variable that equals false +//use an if statement telling program what to console.log('true') if either of the varaibles are true +//use blank else statement so the function sudo-stops. +//call the function + +const sadness = (pizza, beer) => { + if(pizza !== 'hot' && beer !== 'cold'){ + return true; + } +}; sadness('cold', 'hot'); diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 16f58790a..bf4e4fdcf 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -1,7 +1,19 @@ -'use strict'; +// Student: Jon Gorman +// Class: 211 Java Tue/Thur +// Instructor: Renee Dudley +// Date: 10/10/17 +//White Boarding + +//Create a function for the game. +//Function should include a way to check for a tie +//function should include a way to check for win with player1 +//Function should have a way to check for a win with player2 +//function should have a way to check that game is played correctly i.e.(no use of words other tha those needed for game + +'use strict' const assert = require('assert'); -const readline = require('readline'); +const readline = require('readline');`` const rl = readline.createInterface({ input: process.stdin, output: process.stdout @@ -9,11 +21,18 @@ const rl = readline.createInterface({ function rockPaperScissors(hand1, hand2) { - +//check for a tie + if(hand1 === hand2){ + return '\x1b[31mIts a Tie\nYou need to redo the turn! \x1b[0m'; // Write code here - + }else if(hand1 === 'rock' && hand2 === 'scissors' || hand1 === 'paper' && hand2 === 'rock' || hand1 === 'scissors' && hand2 === 'paper'){ + return '\x1b[32mHand1 has won this round! \x1b[0m' + }else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock'){ + return '\x1b[34mHand2 has won this round! \x1b[0m' + }else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ + return '\x1b[4mYour tryig to play a different game! \x1b[0m' + } } - function getPrompt() { rl.question('hand1: ', (answer1) => { rl.question('hand2: ', (answer2) => {