6 Commits

Author SHA1 Message Date
m-endo
da659b5013 Merge branch 'main' of https://gitea.it-college.co.jp/2026_0910_AI_5G_Java_MUN/java-cui-string-checker into m-endo 2026-09-10 14:09:43 +09:00
m-endo
1c61714e91 段階1修正 2026-09-09 16:19:23 +09:00
m-endo
45897f0656 段階1提出 2026-09-09 16:05:16 +09:00
m-endo
087422fc28 3段階サンプルコードにて完成 2026-09-09 15:12:23 +09:00
m-endo
62eb5f9305 段階2です 2026-09-09 10:54:29 +09:00
m-endo
d5f4b1c117 段階1コミット 2026-09-08 16:50:38 +09:00
8 changed files with 94 additions and 70 deletions

1
.gitignore vendored
View File

@@ -24,3 +24,4 @@
hs_err_pid* hs_err_pid*
replay_pid* replay_pid*
/.metadata/

View File

@@ -1,70 +0,0 @@
import java.util.Scanner;
public class StringCheck_shimizu {
public static void main(String[] args) {
//画面に表示するメッセージ
String[] messages = {
"いまなにしてる?",
"何も入力されていません",
"投稿文が長すぎます",
"↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓"
};
// //段階1
// for (String message : messages) {
// System.out.println(message);
// }
Scanner scanner = new Scanner(System.in);
String Str = "";
while (true) {
//"いまなにしてる?"
System.out.println(messages[0]);
//入力された文字を取得
Str = scanner.nextLine().strip();
//"何も入力されていません"
boolean isEnpty = Str.length() == 0;
//System.out.println(isEnpty);
//"投稿文が長すぎます"
boolean ismojisu = Str.length() > 140;
//System.out.println(ismojisu);
int nokori = 140 - Str.length();
//System.out.println(nokori);
if (isEnpty) {
System.out.println(messages[1]);
continue;
}
if (ismojisu) {
System.out.println(messages[2]);
continue;
}
break;
}
//空行
System.out.println();
//↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓
System.out.println(messages[3]);
System.out.println(Str);
}
}

10
lesson1/.classpath Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
lesson1/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin/

17
lesson1/.project Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lesson1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=21

View File

@@ -0,0 +1,52 @@
package lesson1;
import java.util.Scanner;
public class StringCheck {
public static void main(String[] args) {
String[] comment = new String[4];
comment[0] = "いまなにしてる?";
comment[1] = "何も入力されていません";
comment[2] = "投稿文が長すぎます";
comment[3] = "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓";
System.out.println(comment[0]);
Scanner scanner = new Scanner(System.in);
String text = scanner.next();
String str = text.strip();
System.out.println("\n" + comment[3]);
System.out.println(str);
boolean isEmpty = str.isEmpty();
System.out.println(isEmpty);
int strLength = str.length();
System.out.println(strLength + "文字");
boolean isRange = strLength > 140;
System.out.println(isRange);
System.out.println(140 - str.length());
//一日目
for (String a : comment ) {
System.out.println(a);
}
while (true) {
int strLength = str.length();
System.out.println(strLength + "文字");
boolean isRange = strLength > 140;
System.out.println(isRange);
System.out.println(140 - str.length());
}
}
}