2 Commits

Author SHA1 Message Date
f1ffaf5116 3日目 段階1 小澤 2026-09-16 14:57:08 +09:00
bd691238e7 2日目 コミットしてなかった分 2026-09-16 14:56:47 +09:00
5 changed files with 76 additions and 25 deletions

View File

@@ -10,7 +10,6 @@ public class EmployeeData {
static final String COMPANY_NAME = "Rhizome";
@Override
public String toString() {
return getIdEmployee() + "\t" + getNmEmployee() + " " + getKnEmployee() + "\t" + getMailAddress()
@@ -31,23 +30,29 @@ public class EmployeeData {
public EmployeeData(String idEmployee, String nmEmployee, String knEmployee, String mailAddress, String password,
String idDepartment) {
nmEmployee=nmEmployee.strip();
nmEmployee = nmEmployee.strip();
int nmNum = nmEmployee.length();
if(nmNum==0) {
idEmployee = idEmployee.strip();
int idNum = idEmployee.length();
if (nmNum == 0) {
System.out.println("社員名が空のため設定できませんでした");
}
if(nmNum>0){
if (idNum == 0) {
System.out.println("社員IDが空のため設定できませんでした");
}
if (nmNum > 0 && idNum > 0) {
this.setIdEmployee(idEmployee);
this.setNmEmployee(nmEmployee);
this.setKnEmployee(knEmployee);
this.setMailAddress(mailAddress);
this.setPassword(password);
this.setIdDepartment(idDepartment);
empCount++;
this.setIdEmployee(idEmployee);
this.setNmEmployee(nmEmployee);
this.setKnEmployee(knEmployee);
this.setMailAddress(mailAddress);
this.setPassword(password);
this.setIdDepartment(idDepartment);
empCount++;
}
}
@@ -100,8 +105,4 @@ public class EmployeeData {
this.idDepartment = idDepartment;
}
}

View File

@@ -2,7 +2,7 @@
public class Main {
public static void main(String[] args) {
EmployeeData[] employee = new EmployeeData[5];
employee[0] = new EmployeeData("10000"," ","ヤマダタツヤ","yamada@hoge.jp","aaa","10");
employee[0] = new EmployeeData("10000","","ヤマダタツヤ","yamada@hoge.jp","aaa","10");
employee[1] = new EmployeeData();
employee[2] = new EmployeeData();
employee[3] = new EmployeeData();
@@ -48,6 +48,9 @@ public class Main {
for(int i=0;i<5;i++) {
if(employee[i].getNmEmployee()==null) {
continue;
}
System.out.println(employee[i]);
}

View File

@@ -0,0 +1,22 @@
package day3_123;
public class Circle extends Shape {
private double radius;
public Circle(double radius) {
super("円");
this.radius=radius;
}
@Override
public double area() {
return Math.PI*radius*radius;
}
@Override
public void showInfo() {
super.showInfo();
System.out.println("(半径:"+this.radius+")");
}
}

View File

@@ -0,0 +1,10 @@
package day3_123;
public class Day3Check1 {
public static void main(String[] args) {
Circle circle=new Circle(2);
circle.showInfo();
}
}

View File

@@ -0,0 +1,15 @@
package day3_123;
public abstract class Shape {
private String name;
public Shape(String name) {
this.name=name;
}
public abstract double area();
public void showInfo() {
System.out.println(this.name+"の面積は"+this.area()+"です");
}
}