diff --git a/4/img/avocado.png b/4/img/avocado.png new file mode 100644 index 0000000..ea8d58b Binary files /dev/null and b/4/img/avocado.png differ diff --git a/4/img/basket.png b/4/img/basket.png new file mode 100644 index 0000000..ed353a6 Binary files /dev/null and b/4/img/basket.png differ diff --git a/4/img/carrot.jpg b/4/img/carrot.jpg new file mode 100644 index 0000000..411cd29 Binary files /dev/null and b/4/img/carrot.jpg differ diff --git a/4/img/carrot.png b/4/img/carrot.png new file mode 100644 index 0000000..ad1679b Binary files /dev/null and b/4/img/carrot.png differ diff --git a/4/lesson_4.js b/4/lesson_4.js new file mode 100644 index 0000000..3819bd3 --- /dev/null +++ b/4/lesson_4.js @@ -0,0 +1,48 @@ +// Task 1 +var num_1 = prompt("please type number from 0 to 999: ") +if (num_1 > 999){ + alert("your number " + num_1 + " bigger than 999"); +} +else{ + var units = num_1 %10 + num_1 = Math.floor(num_1 / 10); + if (num_1 >= 1){ + var dozens = num_1 %10 + num_1 = Math.floor(num_1 / 10); + if(num_1 >= 1){ + var hundreds = num_1 %10 + alert("hundreds: " + hundreds + "dozens: " + dozens + "units: " + units) + } + else{ + alert("dozens: " + dozens + "units: " + units) + } + } + else{ + alert("units: " + units) + } +} + +//Task 2 +let cart = { + "soap": 25 , + "paint": 35, + "cloth": 200 +}; + + + + +function countBasketPrice(user_cart){ + var price = 0; + for(var i in user_cart){ + price = price + user_cart[i]; + } + return(price); +} + +alert(countBasketPrice(cart)) + + + + + diff --git a/4/styles.css b/4/styles.css new file mode 100644 index 0000000..a90479f --- /dev/null +++ b/4/styles.css @@ -0,0 +1,22 @@ +.cart { + background: url(img/basket.png); + margin: 300px auto; + height: 157px; + width: 150px; + +} + +.carrot{ + background: url(img/carrot.jpg); + margin: 200px auto; + height: 250px; + width: 300px; +} + +.avocado{ + background: url(img/avocado.png); + margin-top: 100px; + margin-left: 240px; + height: 250px; + width: 300px; +} \ No newline at end of file diff --git a/4/tests.html b/4/tests.html new file mode 100644 index 0000000..b824d05 --- /dev/null +++ b/4/tests.html @@ -0,0 +1,15 @@ + + + + + Document + + + + +
+
+
+ + + \ No newline at end of file