Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @(#)Team.java
- *
- *
- * @author
- * @version 1.00 2010/4/30
- */
- import java.util.*;
- public class Team {
- private String team;
- private String name;
- private int BallPosition=0;
- private int teamscore=0;
- private int pass = (int)(Math.random()*2+1);
- private int defendershoot = (int)(Math.random()*10+1);
- private int midshoot = (int)(Math.random()*10+1);
- private int strikershoot = (int)(Math.random()*2+1);
- public void ReadTeam() {
- Scanner scan = new Scanner(System.in);
- System.out.print("Player: Where is your team from? ");
- team=scan.nextLine();
- System.out.print("Player: What is their name? ");
- name=scan.nextLine();
- }
- public void SetTeam(){
- System.out.println(team.toString()+" "+name.toString());
- }
- public void BallPlayer(){
- if(BallPosition==0){
- System.out.println("Defender");
- }
- else if(BallPosition==1){
- System.out.println("Midfielder");
- }
- else if(BallPosition==2){
- System.out.println("Striker");
- }
- }
- public void pass(){
- if(pass==1){
- if(BallPosition<3){
- System.out.println("The pass was succesfull");
- BallPosition++;
- }
- else if(BallPosition>2){
- BallPosition=2;
- System.out.println("The pass was succesfull");
- }
- }
- else if(pass==2){
- System.out.println("The pass was fail!!!! Team 2 now have the ball");
- BallPosition=0;
- }
- }
- public void score(){
- if(BallPosition==0){
- if(defendershoot==1){
- System.out.println("GOAL!!!!!");
- teamscore++;
- }
- else{
- System.out.println("Miss!!!!!");
- }
- }
- else if(BallPosition==1){
- if(midshoot==1||midshoot==2||midshoot==3){
- System.out.println("GOAL!!!!!");
- teamscore++;
- }
- else{
- System.out.println("Miss!!!!!");
- }
- }
- else if(BallPosition==2){
- if(strikershoot==1){
- System.out.println("GOAL!!!!!");
- teamscore++;
- }
- else{
- System.out.println("Miss!!!!!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement