1日目
This commit is contained in:
6
.classpath
Normal file
6
.classpath
Normal file
@@ -0,0 +1,6 @@
|
||||
<?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"/>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="output" path="build/classes"/>
|
||||
</classpath>
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build/
|
||||
23
.project
Normal file
23
.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>em-oop</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
9
.settings/org.eclipse.jdt.core.prefs
Normal file
9
.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,9 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
|
||||
org.eclipse.jdt.core.compiler.compliance=21
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=21
|
||||
4
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
4
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="21"/>
|
||||
</faceted-project>
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
public class em_oop_kawara {
|
||||
public class BasicCheck1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
13
src/main/java/BasicCheck2.java
Normal file
13
src/main/java/BasicCheck2.java
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
public class BasicCheck2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
Student student = new Student();
|
||||
student.studentId = 1;
|
||||
student.name = "鈴木一郎";
|
||||
|
||||
student.printProfile();
|
||||
}
|
||||
|
||||
}
|
||||
35
src/main/java/BasicCheck3.java
Normal file
35
src/main/java/BasicCheck3.java
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
public class BasicCheck3 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
Item[] items = new Item[3];
|
||||
|
||||
items[0] = new Item();
|
||||
items[0].name = "ノート";
|
||||
items[0].price = 120;
|
||||
items[0].stock = 50;
|
||||
|
||||
|
||||
items[1] = new Item();
|
||||
items[1].name = "消しゴム";
|
||||
items[1] .price = 80;
|
||||
items[1].stock = 30;
|
||||
|
||||
|
||||
items[2] = new Item();
|
||||
items[2].name = "鉛筆";
|
||||
items[2].price = 60;
|
||||
items[2].stock = 100;
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].sell(5);
|
||||
}
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
System.out.println(items[i].name + " 価格:" + items[i].price + "円 在庫:" + items[i].stock );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
6
src/main/java/Book.java
Normal file
6
src/main/java/Book.java
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
public class Book {
|
||||
String title;
|
||||
String author;
|
||||
int price;
|
||||
}
|
||||
10
src/main/java/Item.java
Normal file
10
src/main/java/Item.java
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
public class Item {
|
||||
String name;
|
||||
int price;
|
||||
int stock;
|
||||
|
||||
public void sell(int amount) {
|
||||
this.stock = this.stock - amount;
|
||||
}
|
||||
}
|
||||
11
src/main/java/Student.java
Normal file
11
src/main/java/Student.java
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
public class Student {
|
||||
|
||||
int studentId;
|
||||
String name;
|
||||
|
||||
|
||||
public void printProfile() {
|
||||
System.out.println("学籍番号:"+this.studentId+" 名前:"+this.name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user