From 386ed94ba99dca44f3c5d98246849a0b31360d75 Mon Sep 17 00:00:00 2001 From: Ali Date: Wed, 17 Apr 2024 00:13:01 +0430 Subject: [PATCH 1/2] fc --- Answers/40230112056/que/.vscode/settings.json | 7 +++++ Answers/40230112056/que/README.md | 18 ++++++++++++ .../40230112056/que/src/struct/beater.java | 8 ++++++ .../40230112056/que/src/struct/chaser.java | 8 ++++++ .../40230112056/que/src/struct/keeper.java | 9 ++++++ Answers/40230112056/que/src/struct/match.java | 9 ++++++ Answers/40230112056/que/src/struct/myapp.java | 7 +++++ Answers/40230112056/que/src/struct/play.java | 5 ++++ .../40230112056/que/src/struct/player.java | 14 ++++++++++ .../40230112056/que/src/struct/seeker.java | 8 ++++++ .../40230112056/que/src/struct/success.java | 5 ++++ Answers/40230112056/que/src/struct/team.java | 28 +++++++++++++++++++ 12 files changed, 126 insertions(+) create mode 100644 Answers/40230112056/que/.vscode/settings.json create mode 100644 Answers/40230112056/que/README.md create mode 100644 Answers/40230112056/que/src/struct/beater.java create mode 100644 Answers/40230112056/que/src/struct/chaser.java create mode 100644 Answers/40230112056/que/src/struct/keeper.java create mode 100644 Answers/40230112056/que/src/struct/match.java create mode 100644 Answers/40230112056/que/src/struct/myapp.java create mode 100644 Answers/40230112056/que/src/struct/play.java create mode 100644 Answers/40230112056/que/src/struct/player.java create mode 100644 Answers/40230112056/que/src/struct/seeker.java create mode 100644 Answers/40230112056/que/src/struct/success.java create mode 100644 Answers/40230112056/que/src/struct/team.java 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..8f07855 --- /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.05; + } +} 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..06754cf --- /dev/null +++ b/Answers/40230112056/que/src/struct/match.java @@ -0,0 +1,9 @@ +package struct; + +public class match { + public void start(){ + for(int i=0;i<100;i++){ + + } + } +} diff --git a/Answers/40230112056/que/src/struct/myapp.java b/Answers/40230112056/que/src/struct/myapp.java new file mode 100644 index 0000000..7f515d1 --- /dev/null +++ b/Answers/40230112056/que/src/struct/myapp.java @@ -0,0 +1,7 @@ +package struct; + +public class myapp { + public static void main (String[] jsdbfkjsdf){ + + } +} 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..b8b00fa --- /dev/null +++ b/Answers/40230112056/que/src/struct/team.java @@ -0,0 +1,28 @@ +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() Date: Wed, 17 Apr 2024 00:40:42 +0430 Subject: [PATCH 2/2] finish --- Answers/40230112056/que/src/struct/beater.java | 2 +- Answers/40230112056/que/src/struct/match.java | 10 +++++++++- Answers/40230112056/que/src/struct/myapp.java | 12 +++++++++++- Answers/40230112056/que/src/struct/team.java | 1 - 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Answers/40230112056/que/src/struct/beater.java b/Answers/40230112056/que/src/struct/beater.java index 8f07855..9d78d0c 100644 --- a/Answers/40230112056/que/src/struct/beater.java +++ b/Answers/40230112056/que/src/struct/beater.java @@ -3,6 +3,6 @@ public class beater extends player { public beater(String name, int age){ super(name,age); - this.ch=0.05; + this.ch=0.4; } } diff --git a/Answers/40230112056/que/src/struct/match.java b/Answers/40230112056/que/src/struct/match.java index 06754cf..e8d8df9 100644 --- a/Answers/40230112056/que/src/struct/match.java +++ b/Answers/40230112056/que/src/struct/match.java @@ -1,9 +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 index 7f515d1..60ed123 100644 --- a/Answers/40230112056/que/src/struct/myapp.java +++ b/Answers/40230112056/que/src/struct/myapp.java @@ -2,6 +2,16 @@ 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/team.java b/Answers/40230112056/que/src/struct/team.java index b8b00fa..beab708 100644 --- a/Answers/40230112056/que/src/struct/team.java +++ b/Answers/40230112056/que/src/struct/team.java @@ -22,7 +22,6 @@ public void play (){ else if (Math.random()