---
# System prepended metadata

title: Untitled

---

class  Human {                          //Humanの定義
    String name; 			//名前を保持するフィールド変数。クラス内で使用される変数宣言。
    String age;
    String hobby;
    
    void selfIntroduction () {	        //自己紹介するメソッド
    	 System.out.println("私は" + name + age+ です。趣味は+hobby+"です");
    }     
}




public class ExamHuman {
    public static void main (String[] args) {
        System.out.println("programmed by 城間涼子.");
	        Human h1 = new Human();
        	Human h2 = new Human();  // Humanクラス
            h1.name = args[0];
            h2.name = args[3];
            h1.age = args[1];
            h2.age = args[4];
            h1.hobby = args[2];
            h2.hobby = args[5];
                        
            h1.selfIntroduction(); 
	        h2.selfIntroduction();
    }
}










public class ExamTree {
public static void main(String[] args) {
	System.out.println("programmed by 城間涼子.");
	Tree tree1 = new Tree();
	tree1.set(100, 5);
	Tree tree2 = new Tree();
	tree2.set(150, 7);
	tree1.grow(2);
	tree2.grow(2);
    
	System.out.println("tree1の2年後の高さは" + tree1.getHeight() + "mm");
	System.out.println("tree2の2年後の高さは" + tree2.getHeight() + "mm");
	tree1.grow(20);
	tree2.grow(20);
	System.out.println("tree1の20年後の高さは" + tree1.getHeight() + "mm");
	System.out.println("tree2の20年後の高さは" + tree2.getHeight() + "mm");
}
}

class Tree {
     double height;
     double growthRate;
     double year;
      
      void set (double height,double growthRate){
      this.height = height;
      this.growthRate = growthRate; 
      }
      
      void grow(double year){
      this.year = year;
      }
      
      double getHeight(){
      double jojo=0;
      growthRate*year+height = jojo;
      return jojo;
      }
      
}


C:\Users\ic161214\Desktop\授業\五年生\応用プロ２\practice11\ExamTree>javac ExamTree.java
ExamTree.java:36: エラー: 予期しない型
      growthRate*year+height = jojo;
                     ^
  期待値: 変数
  検出値:    値
エラー1個

jojo = growthRate*year+height;