diff --git a/Answers/40230212043/HarryPotter/.idea/.gitignore b/Answers/40230212043/HarryPotter/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Answers/40230212043/HarryPotter/.idea/misc.xml b/Answers/40230212043/HarryPotter/.idea/misc.xml new file mode 100644 index 0000000..bcb5da6 --- /dev/null +++ b/Answers/40230212043/HarryPotter/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/.idea/modules.xml b/Answers/40230212043/HarryPotter/.idea/modules.xml new file mode 100644 index 0000000..2638af4 --- /dev/null +++ b/Answers/40230212043/HarryPotter/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/.idea/vcs.xml b/Answers/40230212043/HarryPotter/.idea/vcs.xml new file mode 100644 index 0000000..d23592a --- /dev/null +++ b/Answers/40230212043/HarryPotter/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/.idea/workspace.xml b/Answers/40230212043/HarryPotter/.idea/workspace.xml new file mode 100644 index 0000000..eda3b8f --- /dev/null +++ b/Answers/40230212043/HarryPotter/.idea/workspace.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1712657905080 + + + + \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/HarryPotter.iml b/Answers/40230212043/HarryPotter/HarryPotter.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Answers/40230212043/HarryPotter/HarryPotter.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Beater.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Beater.class new file mode 100644 index 0000000..def1b60 Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Beater.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Chaser.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Chaser.class new file mode 100644 index 0000000..d0dde98 Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Chaser.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Keeper.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Keeper.class new file mode 100644 index 0000000..e895e5d Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Keeper.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Match.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Match.class new file mode 100644 index 0000000..1c92233 Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Match.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Myapp.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Myapp.class new file mode 100644 index 0000000..16ba7f7 Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Myapp.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Player.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Player.class new file mode 100644 index 0000000..b09f774 Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Player.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Seeker.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Seeker.class new file mode 100644 index 0000000..e35da9e Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Seeker.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Success.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Success.class new file mode 100644 index 0000000..273dc2a Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Success.class differ diff --git a/Answers/40230212043/HarryPotter/out/production/HarryPotter/Team.class b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Team.class new file mode 100644 index 0000000..f7fae0d Binary files /dev/null and b/Answers/40230212043/HarryPotter/out/production/HarryPotter/Team.class differ diff --git a/Answers/40230212043/HarryPotter/src/Beater.java b/Answers/40230212043/HarryPotter/src/Beater.java new file mode 100644 index 0000000..5d28d90 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Beater.java @@ -0,0 +1,11 @@ +import java.util.Random; +public class Beater extends Player { + public boolean isSuccessful() { + Random con=new Random(); + int p=con.nextInt(100)+1; + if (p>=60) { + return true; + } + return false; + } +} diff --git a/Answers/40230212043/HarryPotter/src/Chaser.java b/Answers/40230212043/HarryPotter/src/Chaser.java new file mode 100644 index 0000000..e539fa8 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Chaser.java @@ -0,0 +1,11 @@ +import java.util.Random; +public class Chaser extends Player implements Success { + public boolean isSuccessful() { + Random con=new Random(); + int p=con.nextInt(100)+1; + if (p>=70) { + return true; + } + return false; + } +} diff --git a/Answers/40230212043/HarryPotter/src/Keeper.java b/Answers/40230212043/HarryPotter/src/Keeper.java new file mode 100644 index 0000000..892a14e --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Keeper.java @@ -0,0 +1,11 @@ +import java.util.Random; +public class Keeper extends Player implements Success { + public boolean isSuccessful() { + Random con = new Random(); + int p = con.nextInt(100) + 1; + if (p >= 30) { + return true; + } + return false; + } +} diff --git a/Answers/40230212043/HarryPotter/src/Match.java b/Answers/40230212043/HarryPotter/src/Match.java new file mode 100644 index 0000000..4a95038 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Match.java @@ -0,0 +1,35 @@ +public class Match { + Team team1=new Team(); + Team team2=new Team(); + public void start() { + for (int i=0;i<=100;i++) { + team1.play(); + team2.play(); + if (team1.see.mov==true || team2.see.mov==true) { + break; + } + team1.see.mov=false; + team1.kee.mov=false; + team1.ch1.mov=false; + team1.ch2.mov=false; + team1.ch3.mov=false; + team1.be1.mov=false; + team1.be2.mov=false; + team2.see.mov=false; + team2.kee.mov=false; + team2.ch1.mov=false; + team2.ch2.mov=false; + team2.ch3.mov=false; + team2.be1.mov=false; + team2.be2.mov=false; + } + System.out.println("team1:"+team1.g+"\t"+"team2:"+team2.g); + if (team1.g> team2.g) { + System.out.print("winner: team1"); + } else if (team2.g> team1.g) { + System.out.print("winner: team2"); + } else { + System.out.print("mosavi!"); + } + } +} diff --git a/Answers/40230212043/HarryPotter/src/Myapp.java b/Answers/40230212043/HarryPotter/src/Myapp.java new file mode 100644 index 0000000..24d04f4 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Myapp.java @@ -0,0 +1,6 @@ +public class Myapp{ + public static void main(String[] args) { + Match obj=new Match(); + obj.start(); + } +} \ No newline at end of file diff --git a/Answers/40230212043/HarryPotter/src/Player.java b/Answers/40230212043/HarryPotter/src/Player.java new file mode 100644 index 0000000..5e021f4 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Player.java @@ -0,0 +1,5 @@ +public class Player { + int nu; + String name; + boolean mov=false; +} diff --git a/Answers/40230212043/HarryPotter/src/Team.java b/Answers/40230212043/HarryPotter/src/Team.java new file mode 100644 index 0000000..7e62258 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/Team.java @@ -0,0 +1,28 @@ +public class Team { + int g=0; + private void setGoal() { + g++; + } + Seeker see=new Seeker(); + Keeper kee=new Keeper(); + Chaser ch1=new Chaser(); + Chaser ch2=new Chaser(); + Chaser ch3=new Chaser(); + Beater be1=new Beater(); + Beater be2=new Beater(); + public void play() { + see.mov=see.isSuccessful(); + kee.mov=kee.isSuccessful(); + ch1.mov=ch1.isSuccessful(); + ch2.mov=ch2.isSuccessful(); + ch3.mov=ch3.isSuccessful(); + be1.mov=be1.isSuccessful(); + be2.mov=be2.isSuccessful(); + if (kee.mov==true || (be1.mov==true || be2.mov==true) || ((ch1.mov==true && ch2.mov==true) || (ch2.mov==true && ch3.mov==true) || (ch1.mov==true && ch3.mov==true))) { + setGoal(); + } + if (see.mov==true) { + g+=150; + } + } +} diff --git a/Answers/40230212043/HarryPotter/src/seeker.java b/Answers/40230212043/HarryPotter/src/seeker.java new file mode 100644 index 0000000..8fd201e --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/seeker.java @@ -0,0 +1,11 @@ +import java.util.Random; +public class Seeker extends Player implements Success { + public boolean isSuccessful() { + Random con=new Random(); + int p=con.nextInt(100)+1; + if (p>=95) { + return true; + } + return false; + } +} diff --git a/Answers/40230212043/HarryPotter/src/success.java b/Answers/40230212043/HarryPotter/src/success.java new file mode 100644 index 0000000..c748298 --- /dev/null +++ b/Answers/40230212043/HarryPotter/src/success.java @@ -0,0 +1,3 @@ +public interface Success { + public boolean isSuccessful(); +} diff --git a/HarryPotter/src/Main.java b/HarryPotter/src/Main.java new file mode 100644 index 0000000..fb7039d --- /dev/null +++ b/HarryPotter/src/Main.java @@ -0,0 +1,2 @@ +package PACKAGE_NAME;public class Main { +}