Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. String holdsName, userTeamName;
  9. int sucessOfKick;
  10. Random penaltyGen = new Random();
  11. Scanner Scanner = new Scanner(System.in);
  12.  
  13.  
  14. System.out.println ("Hello which player would you like to take the last pentaly for you? This is a VERY important game!");
  15.  
  16. System.out.println ("((Input player name))");
  17. holdsName = Scanner.next();
  18.  
  19. System.out.println ("((Input team name))");
  20.  
  21. userTeamName = Scanner.next();
  22.  
  23. Scanner.close();
  24.  
  25. players userPlayer = new players(holdsName, userTeamName);
  26. System.out.println(userPlayer);
  27.  
  28. //----------------------------------------//
  29.  
  30.  
  31. sucessOfKick = penaltyGen.nextInt(10) + 1; //random num between 1 and 10. Will not be zero.
  32. System.out.println(sucessOfKick);
  33.  
  34. if (sucessOfKick <= 4){
  35. System.out.println("OH! That's too bad for the team as the ball goes wide.");
  36. }
  37. else {
  38. System.out.println("It's in!");
  39. }
  40. }
  41. }
  42.  
  43. public class players {
  44.  
  45. String playerName;
  46. String teamName;
  47.  
  48. public players (String name, String userTeamName){
  49. playerName = name;
  50. teamName = userTeamName;
  51. }
  52.  
  53. public String toString () {
  54. return "Let's welcome number " + playerName + " from " + teamName + "!";
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement