Skip to content
Open

done #42

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Answers/40230112056/que/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
18 changes: 18 additions & 0 deletions Answers/40230112056/que/README.md
Original file line number Diff line number Diff line change
@@ -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).
8 changes: 8 additions & 0 deletions Answers/40230112056/que/src/struct/beater.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package struct;

public class beater extends player {
public beater(String name, int age){
super(name,age);
this.ch=0.4;
}
}
8 changes: 8 additions & 0 deletions Answers/40230112056/que/src/struct/chaser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package struct;

public class chaser extends player {
public chaser(String name, int age){
super(name,age);
this.ch=0.05;
}
}
9 changes: 9 additions & 0 deletions Answers/40230112056/que/src/struct/keeper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package struct;

public class keeper extends player {

public keeper(String name, int age){
super(name,age);
this.ch=0.7;
}
}
17 changes: 17 additions & 0 deletions Answers/40230112056/que/src/struct/match.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
17 changes: 17 additions & 0 deletions Answers/40230112056/que/src/struct/myapp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package struct;

public class myapp {
public static void main (String[] jsdbfkjsdf){
match p = new match();
p.start();
if (p.g1<p.g2){
System.out.format("team 2 wins with %d score ; team 1 score = %d",p.g2,p.g1);
}
else if (p.g1>p.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 ");
}
}
}
5 changes: 5 additions & 0 deletions Answers/40230112056/que/src/struct/play.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package struct;

public class play {

}
14 changes: 14 additions & 0 deletions Answers/40230112056/que/src/struct/player.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
8 changes: 8 additions & 0 deletions Answers/40230112056/que/src/struct/seeker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package struct;

public class seeker extends player {
public seeker(String name, int age){
super(name,age);
this.ch=0.05;
}
}
5 changes: 5 additions & 0 deletions Answers/40230112056/que/src/struct/success.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package struct;

public interface success {
boolean issuccessful();
}
27 changes: 27 additions & 0 deletions Answers/40230112056/que/src/struct/team.java
Original file line number Diff line number Diff line change
@@ -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()<skr.ch ) {
g+=150;
}
else if (Math.random()<kpr.ch && ( Math.random()<btr1.ch || Math.random()<btr2.ch ) &&
(Math.random()<csr1.ch && Math.random()<csr2.ch) ) {
setgoal();
}
}
}