fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.07s 52484KB
stdin
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>テスト範囲管理サイト</title>
<style>
body {
  font-family: sans-serif;
  background: #f4f4f4;
  text-align: center;
}
.container {
  background: white;
  padding: 20px;
  margin: 40px auto;
  width: 300px;
  border-radius: 10px;
}
input, button {
  margin: 10px;
  padding: 8px;
}
.progress {
  background: #ddd;
  height: 20px;
  border-radius: 10px;
}
.bar {
  height: 20px;
  background: #4caf50;
  width: 0%;
  border-radius: 10px;
}
</style>
</head>

<body>

<div class="container">
<h2>テスト範囲管理</h2>

<p>テスト日</p>
<input type="date" id="testDate">

<p>開始ページ</p>
<input type="number" id="startPage">

<p>終了ページ</p>
<input type="number" id="endPage">

<br>
<button onclick="calculate()">計画作成</button>

<h3 id="result"></h3>

<div class="progress">
  <div class="bar" id="bar"></div>
</div>

<button onclick="done()">今日の分終了</button>

</div>

<script>
let daily = 0;
let total = 0;
let doneDays = 0;
let days = 0;

function calculate() {
  const testDate = new Date(document.getElementById("testDate").value);
  const today = new Date();

  const start = Number(document.getElementById("startPage").value);
  const end = Number(document.getElementById("endPage").value);

  total = end - start + 1;

  const diff = testDate - today;
  days = Math.ceil(diff / (1000 * 60 * 60 * 24));

  if (days <= 0) {
    document.getElementById("result").innerText = "日付ミスってる";
    return;
  }

  daily = Math.ceil(total / days);

  document.getElementById("result").innerText =
    "1日 " + daily + " ページ進めよう";

  doneDays = 0;
  updateBar();
}

function done() {
  doneDays++;
  updateBar();
}

function updateBar() {
  let percent = (doneDays / days) * 100;
  document.getElementById("bar").style.width = percent + "%";
}
</script>

</body>
</html>

stdout
Standard output is empty