diff --git a/Week1/homework/index.html b/Week1/homework/index.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/Week1/homework/js calculator/index.css b/Week1/homework/js calculator/index.css new file mode 100644 index 000000000..509f95b5e --- /dev/null +++ b/Week1/homework/js calculator/index.css @@ -0,0 +1,29 @@ +body{ + width: 1920px; + height: 1024px; +} + +.main, table{ +width: 400px; +height: 400px; +background-color: gainsboro; +} + + + +.textview{ +background-color: greenyellow; +width: 100%; +border:4px; +font-size: 40px; +border-style:inset; + text-align: center; +} + +.button{ + background-color: silver; + width: 100%; + height: 100%; + font-size: 30px; + border-radius: 15px; +} diff --git a/Week1/homework/js calculator/index.html b/Week1/homework/js calculator/index.html new file mode 100644 index 000000000..2dbb13980 --- /dev/null +++ b/Week1/homework/js calculator/index.html @@ -0,0 +1,44 @@ + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/Week1/homework/js calculator/main.js b/Week1/homework/js calculator/main.js new file mode 100644 index 000000000..3e96fbbcf --- /dev/null +++ b/Week1/homework/js calculator/main.js @@ -0,0 +1,20 @@ +function insert(num){ +document.form.textview.value = document.form.textview.value+num +} + +function equal(){ +var exp = document.form.textview.value + +if(exp){ document.form.textview.value = eval(exp) + } + } +function clean(){ + document.form.textview.value = "" +} + +function back(){ + var exp = document.form.textview.value + + document.form.textview.value = exp.substring(0,exp.length-1) + } + diff --git a/Week1/homework/js-exercises/10_compareArrays.js b/Week1/homework/js-exercises/10_compareArrays.js new file mode 100644 index 000000000..923d09640 --- /dev/null +++ b/Week1/homework/js-exercises/10_compareArrays.js @@ -0,0 +1 @@ +'use strict' \ No newline at end of file diff --git a/Week1/homework/js-exercises/1_logHello.js b/Week1/homework/js-exercises/1_logHello.js new file mode 100644 index 000000000..09dba1901 --- /dev/null +++ b/Week1/homework/js-exercises/1_logHello.js @@ -0,0 +1,11 @@ +'use strict' +console.log("Hello, World!") +console.log("Geia sou, Kosme!") +console.log("Ciao, Mondo!") +console.log("Bonjour, le Monde!") +console.log("Hallo, Welt!") +console.log("Hola, Mundo!") +console.log("Hei, Verden!") +console.log("salve, Mundi!") +console.log("Selam, Dunya!") +console.log("Witaj, Wiecie!") \ No newline at end of file diff --git a/Week1/homework/js-exercises/2_ErrorDebugging.js b/Week1/homework/js-exercises/2_ErrorDebugging.js new file mode 100644 index 000000000..abfb656f2 --- /dev/null +++ b/Week1/homework/js-exercises/2_ErrorDebugging.js @@ -0,0 +1,2 @@ +'use strict' +console.log("I'm Awesome") \ No newline at end of file diff --git a/Week1/homework/js-exercises/3_LogNumber.js b/Week1/homework/js-exercises/3_LogNumber.js new file mode 100644 index 000000000..4d1813ab8 --- /dev/null +++ b/Week1/homework/js-exercises/3_LogNumber.js @@ -0,0 +1,18 @@ +'use strict' +/*First, declare your variable numberX. Do not initialize it (which means, don't give it a value) yet.*/ +var numberX + +/*Add a console.log statement that explains in words what you think the value of x is, like in this example.*/ +console.log("The value of the numberX is null") + +/*Add a console.log statement that logs the value of numberX.*/ +console.log(numberX) + +/*Now initialize your variable numberX with a number (also called an integer in computer science terms).*/ +numberX=5 + +/*Next, add a console.log statement that explains what you think the value of numberX is.*/ +console.log("Now the numberX has a value") + +/*Add a console.log statement that logs the value of numberX.*/ +console.log(numberX) \ No newline at end of file diff --git a/Week1/homework/js-exercises/4_LogString.js b/Week1/homework/js-exercises/4_LogString.js new file mode 100644 index 000000000..f6c3341db --- /dev/null +++ b/Week1/homework/js-exercises/4_LogString.js @@ -0,0 +1,18 @@ +'use strict' +/*Declare a variable myString and assign a string to it. Use your full name, including spaces, as the content for the string.*/ +let myString="Kiriakos Mouzakis"; + +/*Write a console.log statement in which you explain in words what you think the value of the string is.*/ +console.log("The value of myString is my full name"); + +/*Now console.log the variable myString.*/ +console.log(myString); + +/*Now reassign to the variable myString a new string.*/ +myString=("Now I am Batman"); + +/*Just like what you did before write a console.log statement that explains in words what you think will be logged to the console.*/ +console.log("Now the string has changed"); + +/*Now console.log myString again.*/ +console.log(myString); diff --git a/Week1/homework/js-exercises/5_RndNum.js b/Week1/homework/js-exercises/5_RndNum.js new file mode 100644 index 000000000..07916021f --- /dev/null +++ b/Week1/homework/js-exercises/5_RndNum.js @@ -0,0 +1,23 @@ +'use strict' +/*Declare a variable z and assign the number 7.25 to it.*/ +let z=7.25; + +/*Write a console.log statement in which you log the value of z.*/ +console.log("'Z' value is "+z); + +/*Declare another variable a that has the value of z but rounded to the nearest integer.*/ +let a; +a=Math.round(z); + +/*Write a console.log statement in which you log the value of a.*/ +console.log("'A' has the same value but is rounded "+a); + +/*So now we have z and a find a way to compare the two values and store the highest of the two in a new variable. */ +/*Write a console.log statement in which you log the value of the highest value.*/ +function bigger(){ + if(a>z) {console.log("'A' is bigger with value of "+a) + } + else {console.log("'Z' is bigger with value of "+z) + } +} +bigger() \ No newline at end of file diff --git a/Week1/homework/js-exercises/6_arrayAnimals.js b/Week1/homework/js-exercises/6_arrayAnimals.js new file mode 100644 index 000000000..deb47a15c --- /dev/null +++ b/Week1/homework/js-exercises/6_arrayAnimals.js @@ -0,0 +1,23 @@ +'use strict' +/*Declare variable and assign to it an empty array. +Make sure that the name of the variable indicates it contains more than 1 item. For example items instead of item.*/ +let array1=new Array; + +/*Write a console.log statement that explains in words what you think the value of the array is.*/ +console.log("The value of the array is empty") + +/*Write a console.log statement that logs the array.*/ +console.log(array1); + +/*Create a new variable with an array that has 3 of your favorite animals, each in a different string. +Make sure the name of the variables says something about what the variable contains.*/ +let animals=["lion","tiger","panther"]; + +/*Write a console.log statement that logs the second array.*/ +console.log(animals); + +/*Add a statement that adds another string ("Piglet)" to the array of animals.*/ +animals.push("Piglet"); + +/*Write a console.log statement that logs the second array!*/ +console.log(animals); \ No newline at end of file diff --git a/Week1/homework/js-exercises/7_stringLength.js b/Week1/homework/js-exercises/7_stringLength.js new file mode 100644 index 000000000..da5138ec0 --- /dev/null +++ b/Week1/homework/js-exercises/7_stringLength.js @@ -0,0 +1,9 @@ +'use strict' +/*/Declare a variable called mySentence and initialize it with the following string: "Programming is so interesting!".*/ +let mySentence="Programming is so interesting!"; + +/*Figure out (using Google) how to get the length of mySentence.*/ +let stringLength=mySentence.length; + +/*Write a console.log statement to log the length of mySentence.*/ +console.log(stringLength); \ No newline at end of file diff --git a/Week1/homework/js-exercises/8_typeChecker.js b/Week1/homework/js-exercises/8_typeChecker.js new file mode 100644 index 000000000..895098bb0 --- /dev/null +++ b/Week1/homework/js-exercises/8_typeChecker.js @@ -0,0 +1,37 @@ +'use strict' +/*Write a program that checks the data types of two variables and logs to the console SAME TYPE if they are the same type. +If they are different types log Not the same....*/ +/*Declare 4 variables: 2 must be strings and 2 must be objects*/ +let string1="social"; +let string2="hackers"; +let fname={firstname:"kiriakos"}; +let lname={lastname:"mouzakis"}; + +/*Create 6 conditional statements, where for each you check if the data type of one variable is the same as the other*/ +if (typeof string1 === typeof string2) {console.log("string1 and string2 are the same type");} +if (typeof string1 === typeof fname) {console.log("string1 and fname are the same type");} +if (typeof string1 === typeof lname) {console.log("string1 and lname are the same type");} +if (typeof string2 === typeof fname) {console.log("string2 and fname are the same type");} +if (typeof string2 === typeof lname) {console.log("string2 and lname are the same type");} +if (typeof fname === typeof lname) {console.log("fname and lname are the same type");} + +/*Find out how to check the type of a variable*/ +console.log("You can check a type of a variable with the typeof() command eg.. The type of fname is an "+typeof fname); + +/*Write 2 console.log statements to log the type of 2 variables, each with a different data type*/ +console.log(typeof(string1)); +console.log(typeof(lname)); + +/*Now compare the types of your different variables with one another*/ +/*Log Not the same... when the types are different*/ +let num1=1; +if (typeof string1 === typeof string2) {console.log("string1 and string2 are the same type")} else {console.log("Not the same type"); } +if (typeof string1 === typeof fname) {console.log("string1 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof string1 === typeof lname) {console.log("string1 and lname are the same type");} else {console.log("Not the same type"); } +if (typeof string2 === typeof fname) {console.log("string2 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof string2 === typeof lname) {console.log("string2 and lname are the same type");} else {console.log("Not the same type"); } +if (typeof fname === typeof lname) {console.log("fname and lname are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof string1) {console.log("num1 and string1 are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof string2) {console.log("num1 and string2 are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof fname) {console.log("num1 and fname are the same type");} else {console.log("Not the same type"); } +if (typeof num1 === typeof lname) {console.log("num1 and lname are the same type");} else {console.log("Not the same type"); } \ No newline at end of file diff --git a/Week1/homework/js-exercises/9_remainder.js b/Week1/homework/js-exercises/9_remainder.js new file mode 100644 index 000000000..0abce4e30 --- /dev/null +++ b/Week1/homework/js-exercises/9_remainder.js @@ -0,0 +1,9 @@ +'use strict' +/*For each of these, write in comments what the answer is followed by how you came to that conclusion*/ + +/*If x equals 7, and the only other statement is x = x % 3, what would be the value of x after the calculation?*/ +console.log("At first x will have the value 7, then after the division it will take the value of the modulus (% symbol) and will be 1"); +/*If y equals 21, and the only other statement is y = y % 4, what would be the value of y after the calculation?*/ +console.log("At first y will have the value 21, then after the division it will take the value of the modulus (% symbol) and will be 1"); +/*If z equals 13, and the only other statement is z = z % 2, what would be the value of z after the calculation?*/ +console.log("At first z will have the value 13, then after the division it will take the value of the modulus (% symbol) and will be 1"); diff --git a/Week1/homework/main.js b/Week1/homework/main.js deleted file mode 100644 index e69de29bb..000000000