diff --git a/Answers/40230112056/que/.vscode/settings.json b/Answers/40230112056/que/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Answers/40230112056/que/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/Answers/40230112056/que/README.md b/Answers/40230112056/que/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Answers/40230112056/que/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/Answers/40230112056/que/src/struct/beater.java b/Answers/40230112056/que/src/struct/beater.java new file mode 100644 index 0000000..9d78d0c --- /dev/null +++ b/Answers/40230112056/que/src/struct/beater.java @@ -0,0 +1,8 @@ +package struct; + +public class beater extends player { + public beater(String name, int age){ + super(name,age); + this.ch=0.4; + } +} diff --git a/Answers/40230112056/que/src/struct/chaser.java b/Answers/40230112056/que/src/struct/chaser.java new file mode 100644 index 0000000..f34551e --- /dev/null +++ b/Answers/40230112056/que/src/struct/chaser.java @@ -0,0 +1,8 @@ +package struct; + +public class chaser extends player { + public chaser(String name, int age){ + super(name,age); + this.ch=0.05; + } +} diff --git a/Answers/40230112056/que/src/struct/keeper.java b/Answers/40230112056/que/src/struct/keeper.java new file mode 100644 index 0000000..c3d2376 --- /dev/null +++ b/Answers/40230112056/que/src/struct/keeper.java @@ -0,0 +1,9 @@ +package struct; + +public class keeper extends player { + + public keeper(String name, int age){ + super(name,age); + this.ch=0.7; + } +} diff --git a/Answers/40230112056/que/src/struct/match.java b/Answers/40230112056/que/src/struct/match.java new file mode 100644 index 0000000..e8d8df9 --- /dev/null +++ b/Answers/40230112056/que/src/struct/match.java @@ -0,0 +1,17 @@ +package struct; + +public class match { + team t1 = new team(); + team t2 = new team(); + public int g1,g2; + public void start(){ + for(int i=0;i<100;i++){ + t1.play(); + if (t1.getgoal()>=150) break; + t2.play(); + if (t2.getgoal()>=150) break; + } + g1=t1.getgoal(); + g2=t2.getgoal(); + } +} diff --git a/Answers/40230112056/que/src/struct/myapp.java b/Answers/40230112056/que/src/struct/myapp.java new file mode 100644 index 0000000..60ed123 --- /dev/null +++ b/Answers/40230112056/que/src/struct/myapp.java @@ -0,0 +1,17 @@ +package struct; + +public class myapp { + public static void main (String[] jsdbfkjsdf){ + match p = new match(); + p.start(); + if (p.g1p.g2) { + System.out.format("team 1 wins with %d score ; team 2 score = %d",p.g1,p.g2); + } + else { + System.out.println("draw 50 _ 50 "); + } + } +} diff --git a/Answers/40230112056/que/src/struct/play.java b/Answers/40230112056/que/src/struct/play.java new file mode 100644 index 0000000..adc2e0f --- /dev/null +++ b/Answers/40230112056/que/src/struct/play.java @@ -0,0 +1,5 @@ +package struct; + +public class play { + +} diff --git a/Answers/40230112056/que/src/struct/player.java b/Answers/40230112056/que/src/struct/player.java new file mode 100644 index 0000000..1f7737b --- /dev/null +++ b/Answers/40230112056/que/src/struct/player.java @@ -0,0 +1,14 @@ +package struct; + +public class player implements success { + String name ; + int age ; + public player (String name , int age) { + this.name=name; + this.age=age; + } + public double ch ;//chance + public boolean issuccessful(){ + return false; + } +} diff --git a/Answers/40230112056/que/src/struct/seeker.java b/Answers/40230112056/que/src/struct/seeker.java new file mode 100644 index 0000000..6df5a4e --- /dev/null +++ b/Answers/40230112056/que/src/struct/seeker.java @@ -0,0 +1,8 @@ +package struct; + +public class seeker extends player { + public seeker(String name, int age){ + super(name,age); + this.ch=0.05; + } +} diff --git a/Answers/40230112056/que/src/struct/success.java b/Answers/40230112056/que/src/struct/success.java new file mode 100644 index 0000000..372a9f6 --- /dev/null +++ b/Answers/40230112056/que/src/struct/success.java @@ -0,0 +1,5 @@ +package struct; + +public interface success { + boolean issuccessful(); +} diff --git a/Answers/40230112056/que/src/struct/team.java b/Answers/40230112056/que/src/struct/team.java new file mode 100644 index 0000000..beab708 --- /dev/null +++ b/Answers/40230112056/que/src/struct/team.java @@ -0,0 +1,27 @@ +package struct; + +public class team { + keeper kpr = new keeper("ali",18); + seeker skr = new seeker("mohammad",19); + chaser csr1 = new chaser("amir",69); + chaser csr2 = new chaser("reza",20); + chaser csr3 = new chaser("ayoub",22); + beater btr1 = new beater("abolfazl",21); + beater btr2 = new beater("asghar",31); + private int g = 0; + private void setgoal(){ + g++; + } + public int getgoal(){ + return g; + } + public void play (){ + if (Math.random()