From 38192275ae38aeb63009be962519e916735909eb Mon Sep 17 00:00:00 2001 From: ACER Date: Mon, 26 Nov 2018 02:02:39 -0500 Subject: [PATCH 1/3] finish --- index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/index.js b/index.js index e69de29..007eab2 100755 --- a/index.js +++ b/index.js @@ -0,0 +1,29 @@ +function generateCalender(){ + + for(let i = 7 ; i <= 31; i++){ + let print = `Tanggal ${i}:` + let arr = [] + let awal = 7 + if(i % 5 === 0){ + arr.push('Tempat Fitnes Tutup') + }else if(i === 7){ + arr.push('Tono') + arr.push('Anton') + arr.push('Budi') + }else{ + if(i % 2 !== 0 ){ + arr.push(`Tono`) + } + if((i-awal)% 4 === 0){ + arr.push(`Anton`) + } + if((i-awal) % 5 === 0){ + arr.push(`Budi`) + } + } + console.log(`${print} ${arr.join(', ')}`) + } + +} + +generateCalender() \ No newline at end of file From ce83eadb933b7575364bb3a8943eb6db867d7550 Mon Sep 17 00:00:00 2001 From: ACER Date: Mon, 26 Nov 2018 03:53:16 -0500 Subject: [PATCH 2/3] tambah pseudocode --- index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/index.js b/index.js index 007eab2..3634cca 100755 --- a/index.js +++ b/index.js @@ -1,3 +1,29 @@ + +// STORE i WITH 7 +// LOOP i untill greater equals to 31 +// STORE "print" WITH `tanggal i :` +// STORE 'arr' WITH empty Array +// STORE "awal" WITH 7 +// IF i modulus 5 equals to 0 +// PUSH 'Tempat fitness Tutup' to "arr" +// ELSE IF i equals to 7 +// PUSH 'Tono, Anton,Budi' to "arr" +// ELSE +// IF i modulus 2 NOT EQUALS to 0 +// PUSH "Tono" to "arr" +// END IF +// IF Substract i WITH "awal" modulus WITH 4 equals to 0 +// PUSH "Anton" to "arr" +// END IF +// IF Substract i WITH "awal" modulus WITH 5 equals to 0 +// PUSH "Budi" to "arr" +// END IF +// END IF +// DISPLAY "print" + "arr" JOIN WITH "," +// END LOOP + + + function generateCalender(){ for(let i = 7 ; i <= 31; i++){ From 086120de5240a217c18750c5d237140074ad5481 Mon Sep 17 00:00:00 2001 From: ACER Date: Mon, 26 Nov 2018 03:56:26 -0500 Subject: [PATCH 3/3] fix identation --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 3634cca..7a5c759 100755 --- a/index.js +++ b/index.js @@ -26,24 +26,24 @@ function generateCalender(){ - for(let i = 7 ; i <= 31; i++){ + for (let i = 7 ; i <= 31; i++) { let print = `Tanggal ${i}:` let arr = [] let awal = 7 - if(i % 5 === 0){ - arr.push('Tempat Fitnes Tutup') - }else if(i === 7){ + if (i % 5 === 0) { + arr.push('Tempat Fitnes Tutup') + } else if (i === 7) { arr.push('Tono') arr.push('Anton') arr.push('Budi') - }else{ - if(i % 2 !== 0 ){ + } else { + if (i % 2 !== 0 ) { arr.push(`Tono`) } - if((i-awal)% 4 === 0){ + if ((i-awal)% 4 === 0) { arr.push(`Anton`) } - if((i-awal) % 5 === 0){ + if ((i-awal) % 5 === 0) { arr.push(`Budi`) } }