From 35764bee9ec0b365b6dcf67161489edaca13033a Mon Sep 17 00:00:00 2001 From: o-matsuda <26-o-matsuda-stellatecnica@it-college.co.jp> Date: Wed, 16 Sep 2026 13:20:13 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AE=B5=E9=9A=8E1=E5=AE=8C=E4=BA=86=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- em-oop/src/Circle.java | 20 ++++++++++++++++++++ em-oop/src/Day3Check1.java | 9 +++++++++ em-oop/src/Shape.java | 14 ++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 em-oop/src/Circle.java create mode 100644 em-oop/src/Day3Check1.java create mode 100644 em-oop/src/Shape.java diff --git a/em-oop/src/Circle.java b/em-oop/src/Circle.java new file mode 100644 index 0000000..b5f533b --- /dev/null +++ b/em-oop/src/Circle.java @@ -0,0 +1,20 @@ + +public class Circle extends Shape { + private double radius; + + public Circle(double radius) { + super("円"); + this.radius = radius; + } + @Override + public double area() { + double num; + num = Math.PI * radius * radius; + return num; + } + @Override + public void showInfo() { + super.showInfo(); + System.out.println("(半径:" + this.radius + ")"); + } +} diff --git a/em-oop/src/Day3Check1.java b/em-oop/src/Day3Check1.java new file mode 100644 index 0000000..251950e --- /dev/null +++ b/em-oop/src/Day3Check1.java @@ -0,0 +1,9 @@ + +public class Day3Check1 { + + public static void main(String[] args) { + Circle circle = new Circle(2); + circle.showInfo(); + } + +} diff --git a/em-oop/src/Shape.java b/em-oop/src/Shape.java new file mode 100644 index 0000000..baf0a9c --- /dev/null +++ b/em-oop/src/Shape.java @@ -0,0 +1,14 @@ + +public class Shape { + private String name; + + public Shape (String name) { + this.name = name; + } + public double area() { + return 0.0; + } + public void showInfo() { + System.out.println(this.name + "の面積は" +this.area() + "です"); + } +}