From 9153a7704d283e438c4c243c1b538bbb5632b638 Mon Sep 17 00:00:00 2001 From: jdrhfskaaa-ctrl Date: Tue, 10 Feb 2026 17:34:54 +0900 Subject: [PATCH 1/5] =?UTF-8?q?intoroduction=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/saruwatari/intoroduction.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 members/saruwatari/intoroduction.md diff --git a/members/saruwatari/intoroduction.md b/members/saruwatari/intoroduction.md new file mode 100644 index 0000000..4fad5e7 --- /dev/null +++ b/members/saruwatari/intoroduction.md @@ -0,0 +1 @@ +こんにちは \ No newline at end of file From 2ded7e1d111a07651bf52a0dbc9a1cc76433c335 Mon Sep 17 00:00:00 2001 From: jdrhfskaaa-ctrl Date: Sun, 15 Feb 2026 09:35:03 +0900 Subject: [PATCH 2/5] =?UTF-8?q?phase1=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/saruwatarii/phase1/greeting.js | 32 ++++++++++++++++++++++++++ members/saruwatarii/phase1/ipo_crad.md | 9 ++++++++ 2 files changed, 41 insertions(+) create mode 100644 members/saruwatarii/phase1/greeting.js create mode 100644 members/saruwatarii/phase1/ipo_crad.md diff --git a/members/saruwatarii/phase1/greeting.js b/members/saruwatarii/phase1/greeting.js new file mode 100644 index 0000000..2387391 --- /dev/null +++ b/members/saruwatarii/phase1/greeting.js @@ -0,0 +1,32 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.question('名前を入力してください: ', (name) => { + if (!name.trim()) { + console.error('エラー: 名前が入力されていません'); + rl.close(); + return; + } + + // Process: 時間帯に応じて挨拶を変える + const hour = new Date().getHours(); + let greeting; + + if (hour >= 5 && hour < 12) { + greeting = 'おはよう'; + } else if (hour >= 12 && hour < 18) { + greeting = 'こんにちは'; + } else { + greeting = 'こんばんは'; + } + + const result = `${name}、${greeting}`; + + // Output: 名前、挨拶 + console.log(result); + rl.close(); +}); \ No newline at end of file diff --git a/members/saruwatarii/phase1/ipo_crad.md b/members/saruwatarii/phase1/ipo_crad.md new file mode 100644 index 0000000..72aefb0 --- /dev/null +++ b/members/saruwatarii/phase1/ipo_crad.md @@ -0,0 +1,9 @@ +## IPOカード + +コードを書く**前に**、必ずIPOカードを記入する。 + +| 項目 | 内容 | +|------|------| +| **Input** |名前 | +| **Process** |受け取った名前に挨拶(こんにちは)とつける | +| **Output** |名前、こんにちは | \ No newline at end of file From 9e9b92597d4573ead817b62e303b88a92c69593c Mon Sep 17 00:00:00 2001 From: jdrhfskaaa-ctrl Date: Sun, 15 Feb 2026 15:57:49 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Milestone=202:=20=E5=89=B2=E3=82=8A?= =?UTF-8?q?=E5=8B=98=E8=A8=88=E7=AE=97=E6=A9=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/saruwatarii/phase1/ipo_card2.md | 10 ++++++++++ members/saruwatarii/phase1/warikan.js | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 members/saruwatarii/phase1/ipo_card2.md create mode 100644 members/saruwatarii/phase1/warikan.js diff --git a/members/saruwatarii/phase1/ipo_card2.md b/members/saruwatarii/phase1/ipo_card2.md new file mode 100644 index 0000000..ac1d5ec --- /dev/null +++ b/members/saruwatarii/phase1/ipo_card2.md @@ -0,0 +1,10 @@ +## IPOカード + +コードを書く**前に**、必ずIPOカードを記入する。 + +| 項目 | 内容 | +|------|------| +| **Input** |①お会計の合計金額(数値) +②一緒にいる人数(数値) | +| **Process** |合計金額を人数で割る。割り切れない場合は、小数点以下を切り捨てる。 | +| **Output** |「1人あたり 〇〇 円です(端数:△△ 円)」という結果の表示 | \ No newline at end of file diff --git a/members/saruwatarii/phase1/warikan.js b/members/saruwatarii/phase1/warikan.js new file mode 100644 index 0000000..5bb127c --- /dev/null +++ b/members/saruwatarii/phase1/warikan.js @@ -0,0 +1,20 @@ +// IPOカードに基づいた割り勘計算機 +// 実行例: node warikan.js 1000 3 + +// Input: コマンドライン引数を受け取る +const totalAmount = Number(process.argv[2]); // 合計金額 +const people = Number(process.argv[3]); // 人数 + +// 入力チェック(数値でない場合や、0以下の人数を防ぐ) +if (isNaN(totalAmount) || isNaN(people) || people <= 0) { + console.log("エラー: 正しい数値を入力してください。"); + console.log("使い方: node warikan.js <合計金額> <人数>"); + process.exit(1); +} + +// Process: 割り算と端数の計算 +const perPerson = Math.floor(totalAmount / people); // 1人あたり(切り捨て) +const remainder = totalAmount % people; // 端数 + +// Output: 結果の表示 +console.log(`1人あたり ${perPerson} 円です(端数:${remainder} 円)`); \ No newline at end of file From d664180ea14565aa0d3257d8376d9d7a7e250a99 Mon Sep 17 00:00:00 2001 From: jdrhfskaaa-ctrl Date: Sun, 15 Feb 2026 16:16:32 +0900 Subject: [PATCH 4/5] =?UTF-8?q?3:=20ToDo=E3=83=AA=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/saruwatarii/phase1/ipo_card3.md | 9 +++++ members/saruwatarii/phase1/todo.js | 54 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 members/saruwatarii/phase1/ipo_card3.md create mode 100644 members/saruwatarii/phase1/todo.js diff --git a/members/saruwatarii/phase1/ipo_card3.md b/members/saruwatarii/phase1/ipo_card3.md new file mode 100644 index 0000000..aed7042 --- /dev/null +++ b/members/saruwatarii/phase1/ipo_card3.md @@ -0,0 +1,9 @@ +## IPOカード + +コードを書く**前に**、必ずIPOカードを記入する。 + +| 項目 | 内容 | +|------|------| +| **Input** |タスク名(文字列)、なし(コマンド実行のみ)、完了したタスクの番号 | +| **Process** |配列(リスト)に新しいタスクを保存する、保存されている配列の中身を番号付きで取り出す、指定された番号のタスクを配列から削除(または完了マーク) | +| **Output** |「タスクを追加しました」と表示、タスク一覧を表示、「〇〇を完了しました」と表示 | \ No newline at end of file diff --git a/members/saruwatarii/phase1/todo.js b/members/saruwatarii/phase1/todo.js new file mode 100644 index 0000000..05908b9 --- /dev/null +++ b/members/saruwatarii/phase1/todo.js @@ -0,0 +1,54 @@ +const readline = require('readline'); + +// 入力と出力を扱うインターフェースを作成 +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +// タスクを保存する配列(メモリ上) +// プログラムを終了すると、この中身は消えます(揮発性) +const tasks = []; + +console.log('--- ToDoリストアプリ ---'); +console.log('コマンド: add <タスク名>, list, done <タスク名>, exit'); + +// ユーザーの入力を待機するループ +rl.on('line', (line) => { + const args = line.trim().split(' '); + const command = args[0]; + const content = args.slice(1).join(' '); + + // IPOカードに基づいた処理 + if (command === 'add') { + if (content) { + tasks.push(content); + console.log('タスクを追加しました'); + } else { + console.log('エラー: タスク名を入力してください'); + } + } else if (command === 'list') { + if (tasks.length === 0) { + console.log('タスクはありません'); + } else { + console.log('--- タスク一覧 ---'); + tasks.forEach((task, index) => { + console.log(`${index + 1}. ${task}`); + }); + } + } else if (command === 'done') { + // 部分一致で検索(入力が空でない場合のみ) + const index = content ? tasks.findIndex(task => task.includes(content)) : -1; + if (index !== -1) { + const removedTask = tasks.splice(index, 1); + console.log(`${removedTask}を完了しました`); + } else { + console.log('エラー: そのタスクは見つかりませんでした'); + } + } else if (command === 'exit') { + console.log('アプリを終了します'); + rl.close(); + } else { + console.log('無効なコマンドです (使えるコマンド: add, list, done, exit)'); + } +}); \ No newline at end of file From 46ef0f1f295f7a6d47bb2a9aab9208eb25528422 Mon Sep 17 00:00:00 2001 From: jdrhfskaaa-ctrl Date: Sun, 15 Feb 2026 16:33:43 +0900 Subject: [PATCH 5/5] saruP1.4 --- members/saruwatarii/phase1/greeting.js | 6 ++++-- members/saruwatarii/phase1/ipo_card2.md | 7 +++---- members/saruwatarii/phase1/ipo_crad.md | 4 ++-- members/saruwatarii/phase1/todo.js | 16 ++++++++++++++-- members/saruwatarii/phase1/warikan.js | 11 ++++++----- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/members/saruwatarii/phase1/greeting.js b/members/saruwatarii/phase1/greeting.js index 2387391..4bf47b5 100644 --- a/members/saruwatarii/phase1/greeting.js +++ b/members/saruwatarii/phase1/greeting.js @@ -12,11 +12,13 @@ rl.question('名前を入力してください: ', (name) => { return; } - // Process: 時間帯に応じて挨拶を変える + // Process: 名前や時間帯に応じて挨拶を変える const hour = new Date().getHours(); let greeting; - if (hour >= 5 && hour < 12) { + if (name === '田中') { + greeting = 'いつもお世話になっております!'; + } else if (hour >= 5 && hour < 12) { greeting = 'おはよう'; } else if (hour >= 12 && hour < 18) { greeting = 'こんにちは'; diff --git a/members/saruwatarii/phase1/ipo_card2.md b/members/saruwatarii/phase1/ipo_card2.md index ac1d5ec..d840c2d 100644 --- a/members/saruwatarii/phase1/ipo_card2.md +++ b/members/saruwatarii/phase1/ipo_card2.md @@ -4,7 +4,6 @@ | 項目 | 内容 | |------|------| -| **Input** |①お会計の合計金額(数値) -②一緒にいる人数(数値) | -| **Process** |合計金額を人数で割る。割り切れない場合は、小数点以下を切り捨てる。 | -| **Output** |「1人あたり 〇〇 円です(端数:△△ 円)」という結果の表示 | \ No newline at end of file +| **Input** |合計金額(税抜)、人数 | +| **Process** |合計金額に 1.1(10%) を掛けてから、人数で割る。 | +| **Output** |「税込合計 〇〇 円、1人あたり △△ 円です」という表示。 | \ No newline at end of file diff --git a/members/saruwatarii/phase1/ipo_crad.md b/members/saruwatarii/phase1/ipo_crad.md index 72aefb0..5dbde44 100644 --- a/members/saruwatarii/phase1/ipo_crad.md +++ b/members/saruwatarii/phase1/ipo_crad.md @@ -5,5 +5,5 @@ | 項目 | 内容 | |------|------| | **Input** |名前 | -| **Process** |受け取った名前に挨拶(こんにちは)とつける | -| **Output** |名前、こんにちは | \ No newline at end of file +| **Process** |名前が「田中」なら特別メッセージ、それ以外は時間帯に応じた挨拶をつける | +| **Output** |名前、挨拶 | \ No newline at end of file diff --git a/members/saruwatarii/phase1/todo.js b/members/saruwatarii/phase1/todo.js index 05908b9..dc9b37f 100644 --- a/members/saruwatarii/phase1/todo.js +++ b/members/saruwatarii/phase1/todo.js @@ -11,7 +11,7 @@ const rl = readline.createInterface({ const tasks = []; console.log('--- ToDoリストアプリ ---'); -console.log('コマンド: add <タスク名>, list, done <タスク名>, exit'); +console.log('コマンド: add <タスク名>, list, done <タスク名>, search <キーワード>, exit'); // ユーザーの入力を待機するループ rl.on('line', (line) => { @@ -45,10 +45,22 @@ rl.on('line', (line) => { } else { console.log('エラー: そのタスクは見つかりませんでした'); } + } else if (command === 'search') { + if (!content) { + console.log('エラー: 検索キーワードを入力してください'); + } else { + const results = tasks.filter(task => task.includes(content)); + if (results.length === 0) { + console.log('該当するタスクはありません'); + } else { + console.log('--- 検索結果 ---'); + results.forEach(task => console.log(task)); + } + } } else if (command === 'exit') { console.log('アプリを終了します'); rl.close(); } else { - console.log('無効なコマンドです (使えるコマンド: add, list, done, exit)'); + console.log('無効なコマンドです (使えるコマンド: add, list, done, search, exit)'); } }); \ No newline at end of file diff --git a/members/saruwatarii/phase1/warikan.js b/members/saruwatarii/phase1/warikan.js index 5bb127c..ba5d13e 100644 --- a/members/saruwatarii/phase1/warikan.js +++ b/members/saruwatarii/phase1/warikan.js @@ -2,7 +2,7 @@ // 実行例: node warikan.js 1000 3 // Input: コマンドライン引数を受け取る -const totalAmount = Number(process.argv[2]); // 合計金額 +const totalAmount = Number(process.argv[2]); // 合計金額(税抜) const people = Number(process.argv[3]); // 人数 // 入力チェック(数値でない場合や、0以下の人数を防ぐ) @@ -12,9 +12,10 @@ if (isNaN(totalAmount) || isNaN(people) || people <= 0) { process.exit(1); } -// Process: 割り算と端数の計算 -const perPerson = Math.floor(totalAmount / people); // 1人あたり(切り捨て) -const remainder = totalAmount % people; // 端数 +// Process: 消費税計算と割り算 +const totalAmountWithTax = Math.floor(totalAmount * 1.1); // 税込合計(切り捨て) +const perPerson = Math.floor(totalAmountWithTax / people); // 1人あたり(切り捨て) +const remainder = totalAmountWithTax % people; // 端数 // Output: 結果の表示 -console.log(`1人あたり ${perPerson} 円です(端数:${remainder} 円)`); \ No newline at end of file +console.log(`税込合計 ${totalAmountWithTax} 円、1人あたり ${perPerson} 円です(端数:${remainder} 円)`); \ No newline at end of file