From 39d25c4b53207c5fcf96076bc825878379ee79e6 Mon Sep 17 00:00:00 2001 From: nick_milkin Date: Tue, 15 Feb 2022 21:39:53 +0100 Subject: [PATCH 1/2] workspace4 --- .DS_Store | Bin 8196 -> 10244 bytes lesson2/.DS_Store | Bin 0 -> 6148 bytes lesson3/.DS_Store | Bin 0 -> 6148 bytes lesson4/.DS_Store | Bin 0 -> 6148 bytes lesson4/HW4/.idea/.gitignore | 5 +++++ lesson4/HW4/.idea/HW4.iml | 12 ++++++++++++ lesson4/HW4/.idea/modules.xml | 8 ++++++++ lesson4/HW4/.idea/vcs.xml | 6 ++++++ lesson4/HW4/index.html | 10 ++++++++++ 9 files changed, 41 insertions(+) create mode 100644 lesson2/.DS_Store create mode 100644 lesson3/.DS_Store create mode 100644 lesson4/.DS_Store create mode 100644 lesson4/HW4/.idea/.gitignore create mode 100644 lesson4/HW4/.idea/HW4.iml create mode 100644 lesson4/HW4/.idea/modules.xml create mode 100644 lesson4/HW4/.idea/vcs.xml create mode 100644 lesson4/HW4/index.html diff --git a/.DS_Store b/.DS_Store index 12e0c79293e38d05b592f87a5d4524230b06493e..85cd3947cc643e7f56469f6dde757c54f2082659 100644 GIT binary patch delta 202 zcmZp1XbF&DU|?W$DortDU{C-uIe-{M3-C-V6q~50$f&L>`>6;-gt%JkGvk71y%{ROTK9 zX&Tdj_J5>H+0yY672vh=sgHFVQjZ?2pZ*=EI>sn}8sFeMe~lqp$%u=|$T4o?QJPHh zdi_pS)~fH`uY2p>hIbM5brI#Ad^%}$#%Fx>OY1aV#GUvg=@sqThwnPeJ4x0X8$#0U zA?5ru$-25|>1o!T7;a<-Jm2%%wNJBIqrM$9>dpCfF#EEP`0$`PpZng&&%0lLwg>4j z)7NI|r0}U4+jO{q8w4w)_!Et@RA*NhT`(66K~X>y5CvYT0&Y9=HeTucW!j>EDDZR& z@ct0M8AFGqMYDCFF(m-7if&_w`G=7?fy2;YX%QnZWvM_*Rj$NPmX7|w<%JGQiDnWy9afk`J7T9j545CtA9z_lN&#^?X>|LcE~B#kH_3cO7PRP`u2YT@17 z*}C+WeAWi=OE??nl@{+Q2+UE8Tt14o;KtA&Z~zP)mKMmR(=~&n_?Ci;k#&h&Rsf9YkLLF=94Cqk_e3LZ^HcOyX#kR;$-C zmoGedT2w_9fJ`TNzkUq6u$${XwOf#_s(->hH#X%g#X z2s5pJ-9JmS$qX<9%)qu7pesm~wzVLy!wfJ3JHr6p4=yO8N0?bOR|hnv1OP06+X&d^ z;~&sP2cSooSp*M=w5fnLRZ@u|sdkVy9pWC1&n((>A{4N@R9${t?JRtlbU})fm8Q3ZVH~IN!?f?J) literal 0 HcmV?d00001 diff --git a/lesson4/.DS_Store b/lesson4/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4803fb22fa31d78d1adff3edcac0a942d21be48a GIT binary patch literal 6148 zcmeHK&1xGl5SDDW))ESaHYCS|Tti~Fp~m#kjkAIFnho)xEw0yV;-%}A@lSj(hCSqx zyio4RJLK3`X=bExQj@qxgUbwzzR`?EvOXDUM+hP7yj=ysUs5PCQr%Q`TCXO|aWL_-{WO%~4Y5F&ejjF^qksBkju(<$GC{Ujca%H?~R z%NJg~E~=v1P(OmMo&=-TXgsX92H&uEs&x|1?N)decP7o!yCa>BT5;MLn1nd$z>x2a zIF0nAuE%LKG`WEdC`UQX($;iZt?jx8)#_~5oz~u$!T#`ZHgnYG&i<#9=C7oe>MP5; zgukSbH-vMz27@+}oL7Rj?)B%Pr$|rxK5bLoUN%0z{e6doP+m_*|A_Xx%Vxa@25F+x zbC_xV>;77rO=f@@U_f{osNkdW4xpb9F#tN&vtDxQ&2q zKK=n+bO3sUnMLq`NSg|1Qzexcl4=KO(;@EB_{^eB7t*W@^U%tYDilejhjh(wAw7%S zG6T%OA_IBbE#doryuAKjOyV9hzzqCX49J2X_;uJ4y{*qShi|P5`V$ld$7L2DQ@}7! hF^t8hcpKCR_+2yrJ;KZ)ctH3=z|g=AGq6$y9sqDsXsG}I literal 0 HcmV?d00001 diff --git a/lesson4/HW4/.idea/.gitignore b/lesson4/HW4/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/lesson4/HW4/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/lesson4/HW4/.idea/HW4.iml b/lesson4/HW4/.idea/HW4.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/lesson4/HW4/.idea/HW4.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/lesson4/HW4/.idea/modules.xml b/lesson4/HW4/.idea/modules.xml new file mode 100644 index 0000000..37e6459 --- /dev/null +++ b/lesson4/HW4/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/lesson4/HW4/.idea/vcs.xml b/lesson4/HW4/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/lesson4/HW4/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lesson4/HW4/index.html b/lesson4/HW4/index.html new file mode 100644 index 0000000..899ed24 --- /dev/null +++ b/lesson4/HW4/index.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file From 80729cba884371bbe48ae436925bd952965693f4 Mon Sep 17 00:00:00 2001 From: nick_milkin Date: Tue, 15 Feb 2022 21:40:05 +0100 Subject: [PATCH 2/2] Homework 4 --- lesson4/HW4/script.js | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lesson4/HW4/script.js diff --git a/lesson4/HW4/script.js b/lesson4/HW4/script.js new file mode 100644 index 0000000..78e9a06 --- /dev/null +++ b/lesson4/HW4/script.js @@ -0,0 +1,60 @@ +// Task 1 + +function numToObj(num) { + objNum.init(num); + return objNum; +} + +const objNum = { + + ['единицы']: 0, + ['десятки']: 0, + ['сотни']: 0, + + init(num){ + this.сотни = Math.floor(num / 100); + num %= 100; + this.десятки = Math.floor(num / 10); + num %= 10; + this.единицы = num; + } +} + +let userNum = parseInt(prompt()); +if (userNum > 999) {console.log('плохое число', objNum)}; + +console.log(numToObj(userNum)); + +// Task 2 + +const item1 = { + name: 'cup', + price: 20, + quantity: 2 +} + +const item2 = { + name: 'plate', + price: 40, + quantity: 4 +} + +const basket = { + contents: [], + + addToBasket(item) { + this.contents.push(item); + }, + + calculateTotal() { + let total = 0 + for (let i = 0; i < this.contents.length; i++) { + total += this.contents[i].price * this.contents[i].quantity; + } + return total; + } +} + +basket.addToBasket(item1); +basket.addToBasket(item2); +console.log(basket.calculateTotal())