// This is a method class
public class Practice_1 {
private int num;
private String nickname;
private String name;
private String type;
private int atk;
private int def;
private int health;
private int magic;
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getAtk() {
return atk;
}
public void setAtk(int atk) {
this.atk = atk;
}
public int getDef() {
return def;
}
public void setDef(int def) {
this.def = def;
}
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
public int getMagic() {
return magic;
}
public void setMagic(int magic) {
this.magic = magic;
}
public void fight1_2() { System.out.println(" Galen yes Ryze "+" Attack "); } public void
fight2_1() { System.out.println(" Ryze yes Galen "+" Attack "); } public void move() {
System.out.println(" move "); } public void die() { System.out.println(" Character death "); }
public void rebirth() { getHealth();
System.out.println(" resurrection "+" The blood volume is full "+getHealth()); }
}
// This is the main class , Call the method of the previous class .

public class TestPractice_1 {
public static void main(String[] args) { Practice_1 p1= new Practice_1();
Practice_1 p2= new Practice_1(); p1.setType(" warrior "); p1.setNum(1);
p1.setNickname(" Power of demacia "); p1.setName(" Galen "); p1.setAtk(10); p1.setDef(10);
p1.setHealth(102); p1.setMagic(0);
System.out.println(" type "+"\t nickname "+"\t\t name "+"\t aggressivity "+"\t Defensive power "+"\t Blood volume "+"\t Magic value ");
System.out.print(p1.getType()+"\t"); System.out.print(p1.getNickname()+"\t");
System.out.print(p1.getName()+"\t"); System.out.print(p1.getAtk()+"\t");
System.out.print(p1.getDef()+"\t"); System.out.print(p1.getHealth()+"\t");
System.out.println(p1.getMagic()+"\t"); p2.setType(" master "); p2.setNum(1);
p2.setNickname(" Wandering mage \t"); p2.setName(" Ryze "); p2.setAtk(20); p2.setDef(5);
p2.setHealth(80); p2.setMagic(100); System.out.print(p2.getType()+"\t");
System.out.print(p2.getNickname()+"\t"); System.out.print(p2.getName()+"\t");
System.out.print(p2.getAtk()+"\t"); System.out.print(p2.getDef()+"\t");
System.out.print(p2.getHealth()+"\t"); System.out.print(p2.getMagic()+"\t");
int a=p1.getHealth(); System.out.println(a); int b = p2.getHealth(); int
b1=p2.getMagic(); System.out.println(); int count1 =0; int count2 =0; do {
p1.fight1_2(); b-=5; if(b>0) { count1++; System.out.println(" Rez was hit and his remaining blood volume was "+b);
}else { System.out.println(" Rez's blood volume is 0"); break; } if(b1>13) { p2.fight2_1();
a-=10; b1-=13; }else { System.out.println(" Ritz has insufficient mana left , Not enough to release skills "); continue; }
if(a>0) { count2++; System.out.println(" Galen was hit by magic, and the remaining HP was "+a+" Ritz mana remaining "+b1); }else {
System.out.println(" Galen's blood volume is 0"); break; } }while(a!=0&&b!=0); if(a==0&&b!=0) {
p1.getName(); p1.die(); }else { p2.getName(); p2.die(); }
System.out.println(" Galen attacked "+count1+" second ");
System.out.println(" Rez attacked in all "+count2+" second "); }
}

Technology