2017-01-01から1年間の記事一覧

Maze

import java.util.Random;public class Maze2 { //マップ初期化(0:壁、1:道、2:スタート、3:ゴール) static int MazeMap={{0,3,0,0,0,1,1,1,1,1}, {0,1,1,1,0,0,0,1,0,1}, {0,1,0,1,1,1,1,1,0,1}, {0,1,1,0,0,0,0,0,0,1}, {0,0,1,1,0,0,0,0,0,1}, …

LifeとFoodとSlave

public class Slave extends Human { Slave(String name,int birthday) { super(name,birthday); } public void swork() { int times = 0; boolean did; while(super.getEnergy() != 100) { super.eat(); } do { did = super.work(); if(did == true) times+…

HumanとHumantest

public class Human{ private static int count_Human = 0; private String name; private int birthday; private int energy; Human(String name,int birthday,int energy) { this.name = name; this.birthday = birthday; this.energy = energy; count_Hum…

VectorとVecJne

public class Vector{ private String name; //メンバ変数1 int Xaxis; //メンバ変数2 int Yaxis; //メンバ変数3 int Zaxis; //メンバ変数4 private static int CountVec = 0; //クラス変数 //コンストラクタ1 Vector(String name,int Xaxis,int Yaxis,…

DiceSum

public class DiceSum { public static void main(String[] args) { int dicesum = 8; System.out.print("三つのサイコロの合計が" + dicesum + "となるのは\n" + Pattern(dicesum) + "\nのときです\n"); } public static String Pattern(int n) { String pt…

OddEven

public class OddEven { public static void main(String args) { //配列の宣言 String OE; OE = new String[2]; //初期化方法その1 OE[0] = "偶数"; OE[1] = "奇数"; /* String OE = new String{"偶数","奇数"}; //初期化方法その2 //new演算子で初期化、…