Trying to output a game Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Output in one windowAlign Strings for OutputFormatting outputArduino serial data input outputSimple input/output practiceImplementation of stackOutput two columnsSimple console dice game, trying to roll two of the same numberConsole output of multiplication tableKeypress output to screen

How is the internal pullup resistor in a microcontroller wired?

How widely used is the term Treppenwitz? Is it something that most Germans know?

ListPlot join points by nearest neighbor rather than order

How to assign captions for two tables in LaTeX?

Gastric acid as a weapon

Do I really need recursive chmod to restrict access to a folder?

macOS-like app switching in Plasma 5

When -s is used with third person singular. What's its use in this context?

Does surprise arrest existing movement?

How much radiation do nuclear physics experiments expose researchers to nowadays?

How can whole tone melodies sound more interesting?

Did Xerox really develop the first LAN?

Why did the IBM 650 use bi-quinary?

Right-skewed distribution with mean equals to mode?

What are the motives behind Cersei's orders given to Bronn?

How to draw this diagram using TikZ package?

Is a manifold-with-boundary with given interior and non-empty boundary essentially unique?

Compressing georeferenced images

List numbering with letters

IndentationError when pasting code in Python 3 interpreter mode

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

Does polymorph use a PC’s CR or its level?

Can Pao de Queijo, and similar foods, be kosher for Passover?



Trying to output a game



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Output in one windowAlign Strings for OutputFormatting outputArduino serial data input outputSimple input/output practiceImplementation of stackOutput two columnsSimple console dice game, trying to roll two of the same numberConsole output of multiplication tableKeypress output to screen



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0












$begingroup$


I need help with the area I think I highlighted with arrows (static void updateTeam & processUpdate)
Suppose to output a game where you type in a team and it will out put win, loss, and ties.






package nfl.game;

import java.util.Random;
import java.util.Scanner;

public class Game
final static int GAME_PLAY = 5;
static Team team;
static Scanner input = new Scanner(System.in);
static int gameRound = 0;
final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
final static String CREATE_ERR_MSG = "Team is already created.";
final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
final static String STATS_ERR_MSG = "No stats available. Create a team first.";
final static String INVALID_ERR_MSG = "Invalid input. Try again.";

public static void main(String[] args)
char choice = ' ';
boolean done = false;
do
do
showMainMenu();
try
choice = input.nextLine().charAt(0);
choice = Character.toUpperCase(choice);
if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
showError(INVALID_ERR_MSG);
pressAnyKey();
else
done = true;

catch (Exception e)
showError(INVALID_ERR_MSG);


while (!done);

while (processSelection(choice));

public static void clearScreen()
for (int i = 0; i < 7; System.out.println(), i++)
;

private static void showError(String message)
System.out.println("n>>>> " + message + " <<<<n");

private static boolean processSelection(char choice)
switch (choice)
case '1': // Play game
if (team != null)
if (gameRound >=5)
System.out.print("Play Again (Y/N)?");
try
choice = input.nextLine().charAt(0);
choice = Character.toUpperCase(choice);
if (choice == 'Y')
gameRound = 0;
team.setScores(new int[] 0, 0, 0 );
play();

catch (Exception e)
showError(INVALID_ERR_MSG);


else
play();

else
showError(PLAY_ERR_MSG);
break;
case '2': // Create Team
if (team == null)
createTeam();
else
showError(CREATE_ERR_MSG);
break;
case '3': //Update Team
if (team != null)
updateTeam();
else
showError(UPDATE_ERR_MSG);
break;
case '4': //Display Stats
if (team != null)
displayStats();
else
showError(STATS_ERR_MSG);
break;
case '5': // Show Roster
if (team != null)
showRoster();
else
showError(TEAM_ERR_MSG);
break;
case 'Q': //Exit Game
showError(TEAM_ERR_MSG);
break;
case 'Q': //Exit Game
quit();
break;

pressAnyKey();
return true;


private static void showRoster()
System.out.println();
System.out.println("----------------------------------------------------");
System.out.println(" TEAM ROSTER");
System.out.println("-----------------------------------------------");
team.showRoster();


private static void quit()
System.out.println();
System.out.println("-------------------------------------");
System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
System.out.println("-------------------------------------");
System.exit(0);


private static void displayStats()
System.out.println();
System.out.println("----------------------------------------------------");
System.out.println(" TEAM STATISTICS");
System.out.println("----------------------------------------------------");
team.showTeamStats();



private static void createTeam()
team = new Team();
System.out.println();
System.out.println("-------------------------------------------------");
System.out.println(" Let's Create Your Team");
System.out.println("-------------------------------------------------");
System.out.println();
System.out.print("Team Name: ");
team.setName(input.nextLine());
System.out.print("Owner Name: ");
team.setOwner(input.nextLine());
System.out.print("Head Coach: ");
team.setCoach(input.nextLine());
System.out.println();
setSide();
team.setSide("Offensive");
System.out.println(" ** Team Created! **");


private static void setSide()
char choice;
do
System.out.print("(1) Defensive or (2) Offensive: ");
choice = input.nextLine().charAt(0);
while (choice != '1' && choice != '2');

if (choice == '1')
setupDefensiveTeam();
else
setupOffensiveTeam();



private static void setupOffensiveTeam()
Player[] players = new Player[6];
for (int i = 0; i < Team.MAX_PLAYERS; i++)
players[i] = new Player();

team.setSide("Offensive");
setupPlayer(players[0], "Quarterback");
setupPlayer(players[1], "Wide Receiver");
setupPlayer(players[2], "Wide Receiver");
setupPlayer(players[3], "Offensive Guard");
setupPlayer(players[4], "Offensive Guard");
setupPlayer(players[5], "Center");


private static void setupDefensiveTeam()
Player[] players = new Player[6];
for(int i = 0; i < Team.MAX_PLAYERS; i++)
players[i] = new Player();

team.setSide("Defensive");
setupPlayer(players[0], "Safety");
setupPlayer(players[1], "Cornerback");
setupPlayer(players[2], "Cornerback");
setupPlayer(players[3], "Defensive Tackle");
setupPlayer(players[4], "Defensive Tackle");
setupPlayer(players[5], "Middle Linebacker");
team.setPlayers(players);


private static void setupPlayer(Player player, String position)
System.out.println("Position: " + position);
player.setPosition(position);
System.out.print("Name:");
player.setName(input.nextLine());
System.out.print("Jersey Number:");
player.setJerseyNumber(input.nextInt());
System.out.print("Height:");
player.setHeight(input.nextInt());
System.out.print("Weight:");
player.setWeight(input.nextInt());
System.out.print("Age:");
player.setAge(input.nextInt());
input.hasNextLine(); //flush out stream


private static void play()
System.out.println("------------------------------------");
System.out.println(" LET'S PLAY. GOOD LUCK!");
System.out.println("------------------------------------");
for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
System.out.println("Round #" + gameRound);
pressAnyKey();

int result = getRandom();
team.updateScore(result); // update score
switch (result)
case 0:
System.out.println(">>> Sorry, You Lost!");
break;
case 1:
System.out.println(">>> You Win!");
break;
case 2:
System.out.println(">>> It's a Tie!");
break;


clearScreen();


private static void pressAnyKey()
System.out.println();
System.out.println("Press any key to start");
input.nextLine();


static void showMainMenu()
System.out.println("----------------------------------");
System.out.println(" NFL GAME");
System.out.println("----------------------------------");
System.out.println("(1) Play");
System.out.println("(2) Create New Team");
System.out.println("(3) Update Team");
System.out.println("(4) Display Team Stats");
System.out.println("(5) Display Roster");
System.out.println("(Q) Exit");

System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


static void showUpdateMenu()
System.out.println("----------------------------------");
System.out.println(" TEAM UPDATE");
System.out.println("----------------------------------");
System.out.println("(1) Edit Team Name");
System.out.println("(2) Edit Owner");
System.out.println("(3) Edit Coach");
System.out.println("(4) Edit Team Stats");
System.out.println("(5) Edit Roster");
System.out.println("(Q) Exit");

System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




> static void updateTeam()
>
>
>
> static void processUpdate()
>
>


static void editPlayers()
System.out.println();
System.out.print("Enter new Players name or (999 to cancel): ");
try
String temp = input.nextLine();
if (!temp.contentEquals("999") && temp.length()>0)
team.setName(temp);
System.out.println(" ** Team Players Edited! ** ");

catch (Exception e)
showError(INVALID_ERR_MSG);



private static void editCoach()
System.out.println();
System.out.print("Enter new Coach name or (999 to cancel): ");
try
String temp = input.nextLine();
if (!temp.contentEquals("999") && temp.length()>0)
team.setName(temp);
System.out.println(" ** Team Coach Edited! ** ");

catch (Exception e)
showError(INVALID_ERR_MSG);



private static void editOwner()
System.out.println();
System.out.print("Enter new Owner name or (999 to cancel): ");
try
String temp = input.nextLine();
if (!temp.contentEquals("999") && temp.length()>0)
team.setName(temp);
System.out.println(" ** Team Owner Edited! ** ");

catch (Exception e)
showError(INVALID_ERR_MSG);




private static void editTeam()
System.out.println();
System.out.print("Enter new team name or (999 to cancel): ");
try
String temp = input.nextLine();
if (!temp.equals("999") && temp.length()>0)
team.setName(temp);
System.out.println(" ** Team Name Edited! **");

catch (Exception e)
showError(INVALID_ERR_MSG);



public static int getRandom()
return new Random().nextInt(2);


}


}












share|improve this question







New contributor




podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$


















    0












    $begingroup$


    I need help with the area I think I highlighted with arrows (static void updateTeam & processUpdate)
    Suppose to output a game where you type in a team and it will out put win, loss, and ties.






    package nfl.game;

    import java.util.Random;
    import java.util.Scanner;

    public class Game
    final static int GAME_PLAY = 5;
    static Team team;
    static Scanner input = new Scanner(System.in);
    static int gameRound = 0;
    final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
    final static String CREATE_ERR_MSG = "Team is already created.";
    final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
    final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
    final static String STATS_ERR_MSG = "No stats available. Create a team first.";
    final static String INVALID_ERR_MSG = "Invalid input. Try again.";

    public static void main(String[] args)
    char choice = ' ';
    boolean done = false;
    do
    do
    showMainMenu();
    try
    choice = input.nextLine().charAt(0);
    choice = Character.toUpperCase(choice);
    if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
    showError(INVALID_ERR_MSG);
    pressAnyKey();
    else
    done = true;

    catch (Exception e)
    showError(INVALID_ERR_MSG);


    while (!done);

    while (processSelection(choice));

    public static void clearScreen()
    for (int i = 0; i < 7; System.out.println(), i++)
    ;

    private static void showError(String message)
    System.out.println("n>>>> " + message + " <<<<n");

    private static boolean processSelection(char choice)
    switch (choice)
    case '1': // Play game
    if (team != null)
    if (gameRound >=5)
    System.out.print("Play Again (Y/N)?");
    try
    choice = input.nextLine().charAt(0);
    choice = Character.toUpperCase(choice);
    if (choice == 'Y')
    gameRound = 0;
    team.setScores(new int[] 0, 0, 0 );
    play();

    catch (Exception e)
    showError(INVALID_ERR_MSG);


    else
    play();

    else
    showError(PLAY_ERR_MSG);
    break;
    case '2': // Create Team
    if (team == null)
    createTeam();
    else
    showError(CREATE_ERR_MSG);
    break;
    case '3': //Update Team
    if (team != null)
    updateTeam();
    else
    showError(UPDATE_ERR_MSG);
    break;
    case '4': //Display Stats
    if (team != null)
    displayStats();
    else
    showError(STATS_ERR_MSG);
    break;
    case '5': // Show Roster
    if (team != null)
    showRoster();
    else
    showError(TEAM_ERR_MSG);
    break;
    case 'Q': //Exit Game
    showError(TEAM_ERR_MSG);
    break;
    case 'Q': //Exit Game
    quit();
    break;

    pressAnyKey();
    return true;


    private static void showRoster()
    System.out.println();
    System.out.println("----------------------------------------------------");
    System.out.println(" TEAM ROSTER");
    System.out.println("-----------------------------------------------");
    team.showRoster();


    private static void quit()
    System.out.println();
    System.out.println("-------------------------------------");
    System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
    System.out.println("-------------------------------------");
    System.exit(0);


    private static void displayStats()
    System.out.println();
    System.out.println("----------------------------------------------------");
    System.out.println(" TEAM STATISTICS");
    System.out.println("----------------------------------------------------");
    team.showTeamStats();



    private static void createTeam()
    team = new Team();
    System.out.println();
    System.out.println("-------------------------------------------------");
    System.out.println(" Let's Create Your Team");
    System.out.println("-------------------------------------------------");
    System.out.println();
    System.out.print("Team Name: ");
    team.setName(input.nextLine());
    System.out.print("Owner Name: ");
    team.setOwner(input.nextLine());
    System.out.print("Head Coach: ");
    team.setCoach(input.nextLine());
    System.out.println();
    setSide();
    team.setSide("Offensive");
    System.out.println(" ** Team Created! **");


    private static void setSide()
    char choice;
    do
    System.out.print("(1) Defensive or (2) Offensive: ");
    choice = input.nextLine().charAt(0);
    while (choice != '1' && choice != '2');

    if (choice == '1')
    setupDefensiveTeam();
    else
    setupOffensiveTeam();



    private static void setupOffensiveTeam()
    Player[] players = new Player[6];
    for (int i = 0; i < Team.MAX_PLAYERS; i++)
    players[i] = new Player();

    team.setSide("Offensive");
    setupPlayer(players[0], "Quarterback");
    setupPlayer(players[1], "Wide Receiver");
    setupPlayer(players[2], "Wide Receiver");
    setupPlayer(players[3], "Offensive Guard");
    setupPlayer(players[4], "Offensive Guard");
    setupPlayer(players[5], "Center");


    private static void setupDefensiveTeam()
    Player[] players = new Player[6];
    for(int i = 0; i < Team.MAX_PLAYERS; i++)
    players[i] = new Player();

    team.setSide("Defensive");
    setupPlayer(players[0], "Safety");
    setupPlayer(players[1], "Cornerback");
    setupPlayer(players[2], "Cornerback");
    setupPlayer(players[3], "Defensive Tackle");
    setupPlayer(players[4], "Defensive Tackle");
    setupPlayer(players[5], "Middle Linebacker");
    team.setPlayers(players);


    private static void setupPlayer(Player player, String position)
    System.out.println("Position: " + position);
    player.setPosition(position);
    System.out.print("Name:");
    player.setName(input.nextLine());
    System.out.print("Jersey Number:");
    player.setJerseyNumber(input.nextInt());
    System.out.print("Height:");
    player.setHeight(input.nextInt());
    System.out.print("Weight:");
    player.setWeight(input.nextInt());
    System.out.print("Age:");
    player.setAge(input.nextInt());
    input.hasNextLine(); //flush out stream


    private static void play()
    System.out.println("------------------------------------");
    System.out.println(" LET'S PLAY. GOOD LUCK!");
    System.out.println("------------------------------------");
    for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
    System.out.println("Round #" + gameRound);
    pressAnyKey();

    int result = getRandom();
    team.updateScore(result); // update score
    switch (result)
    case 0:
    System.out.println(">>> Sorry, You Lost!");
    break;
    case 1:
    System.out.println(">>> You Win!");
    break;
    case 2:
    System.out.println(">>> It's a Tie!");
    break;


    clearScreen();


    private static void pressAnyKey()
    System.out.println();
    System.out.println("Press any key to start");
    input.nextLine();


    static void showMainMenu()
    System.out.println("----------------------------------");
    System.out.println(" NFL GAME");
    System.out.println("----------------------------------");
    System.out.println("(1) Play");
    System.out.println("(2) Create New Team");
    System.out.println("(3) Update Team");
    System.out.println("(4) Display Team Stats");
    System.out.println("(5) Display Roster");
    System.out.println("(Q) Exit");

    System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


    static void showUpdateMenu()
    System.out.println("----------------------------------");
    System.out.println(" TEAM UPDATE");
    System.out.println("----------------------------------");
    System.out.println("(1) Edit Team Name");
    System.out.println("(2) Edit Owner");
    System.out.println("(3) Edit Coach");
    System.out.println("(4) Edit Team Stats");
    System.out.println("(5) Edit Roster");
    System.out.println("(Q) Exit");

    System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




    > static void updateTeam()
    >
    >
    >
    > static void processUpdate()
    >
    >


    static void editPlayers()
    System.out.println();
    System.out.print("Enter new Players name or (999 to cancel): ");
    try
    String temp = input.nextLine();
    if (!temp.contentEquals("999") && temp.length()>0)
    team.setName(temp);
    System.out.println(" ** Team Players Edited! ** ");

    catch (Exception e)
    showError(INVALID_ERR_MSG);



    private static void editCoach()
    System.out.println();
    System.out.print("Enter new Coach name or (999 to cancel): ");
    try
    String temp = input.nextLine();
    if (!temp.contentEquals("999") && temp.length()>0)
    team.setName(temp);
    System.out.println(" ** Team Coach Edited! ** ");

    catch (Exception e)
    showError(INVALID_ERR_MSG);



    private static void editOwner()
    System.out.println();
    System.out.print("Enter new Owner name or (999 to cancel): ");
    try
    String temp = input.nextLine();
    if (!temp.contentEquals("999") && temp.length()>0)
    team.setName(temp);
    System.out.println(" ** Team Owner Edited! ** ");

    catch (Exception e)
    showError(INVALID_ERR_MSG);




    private static void editTeam()
    System.out.println();
    System.out.print("Enter new team name or (999 to cancel): ");
    try
    String temp = input.nextLine();
    if (!temp.equals("999") && temp.length()>0)
    team.setName(temp);
    System.out.println(" ** Team Name Edited! **");

    catch (Exception e)
    showError(INVALID_ERR_MSG);



    public static int getRandom()
    return new Random().nextInt(2);


    }


    }












    share|improve this question







    New contributor




    podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$














      0












      0








      0





      $begingroup$


      I need help with the area I think I highlighted with arrows (static void updateTeam & processUpdate)
      Suppose to output a game where you type in a team and it will out put win, loss, and ties.






      package nfl.game;

      import java.util.Random;
      import java.util.Scanner;

      public class Game
      final static int GAME_PLAY = 5;
      static Team team;
      static Scanner input = new Scanner(System.in);
      static int gameRound = 0;
      final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
      final static String CREATE_ERR_MSG = "Team is already created.";
      final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
      final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
      final static String STATS_ERR_MSG = "No stats available. Create a team first.";
      final static String INVALID_ERR_MSG = "Invalid input. Try again.";

      public static void main(String[] args)
      char choice = ' ';
      boolean done = false;
      do
      do
      showMainMenu();
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
      showError(INVALID_ERR_MSG);
      pressAnyKey();
      else
      done = true;

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      while (!done);

      while (processSelection(choice));

      public static void clearScreen()
      for (int i = 0; i < 7; System.out.println(), i++)
      ;

      private static void showError(String message)
      System.out.println("n>>>> " + message + " <<<<n");

      private static boolean processSelection(char choice)
      switch (choice)
      case '1': // Play game
      if (team != null)
      if (gameRound >=5)
      System.out.print("Play Again (Y/N)?");
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice == 'Y')
      gameRound = 0;
      team.setScores(new int[] 0, 0, 0 );
      play();

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      else
      play();

      else
      showError(PLAY_ERR_MSG);
      break;
      case '2': // Create Team
      if (team == null)
      createTeam();
      else
      showError(CREATE_ERR_MSG);
      break;
      case '3': //Update Team
      if (team != null)
      updateTeam();
      else
      showError(UPDATE_ERR_MSG);
      break;
      case '4': //Display Stats
      if (team != null)
      displayStats();
      else
      showError(STATS_ERR_MSG);
      break;
      case '5': // Show Roster
      if (team != null)
      showRoster();
      else
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      quit();
      break;

      pressAnyKey();
      return true;


      private static void showRoster()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM ROSTER");
      System.out.println("-----------------------------------------------");
      team.showRoster();


      private static void quit()
      System.out.println();
      System.out.println("-------------------------------------");
      System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
      System.out.println("-------------------------------------");
      System.exit(0);


      private static void displayStats()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM STATISTICS");
      System.out.println("----------------------------------------------------");
      team.showTeamStats();



      private static void createTeam()
      team = new Team();
      System.out.println();
      System.out.println("-------------------------------------------------");
      System.out.println(" Let's Create Your Team");
      System.out.println("-------------------------------------------------");
      System.out.println();
      System.out.print("Team Name: ");
      team.setName(input.nextLine());
      System.out.print("Owner Name: ");
      team.setOwner(input.nextLine());
      System.out.print("Head Coach: ");
      team.setCoach(input.nextLine());
      System.out.println();
      setSide();
      team.setSide("Offensive");
      System.out.println(" ** Team Created! **");


      private static void setSide()
      char choice;
      do
      System.out.print("(1) Defensive or (2) Offensive: ");
      choice = input.nextLine().charAt(0);
      while (choice != '1' && choice != '2');

      if (choice == '1')
      setupDefensiveTeam();
      else
      setupOffensiveTeam();



      private static void setupOffensiveTeam()
      Player[] players = new Player[6];
      for (int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Offensive");
      setupPlayer(players[0], "Quarterback");
      setupPlayer(players[1], "Wide Receiver");
      setupPlayer(players[2], "Wide Receiver");
      setupPlayer(players[3], "Offensive Guard");
      setupPlayer(players[4], "Offensive Guard");
      setupPlayer(players[5], "Center");


      private static void setupDefensiveTeam()
      Player[] players = new Player[6];
      for(int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Defensive");
      setupPlayer(players[0], "Safety");
      setupPlayer(players[1], "Cornerback");
      setupPlayer(players[2], "Cornerback");
      setupPlayer(players[3], "Defensive Tackle");
      setupPlayer(players[4], "Defensive Tackle");
      setupPlayer(players[5], "Middle Linebacker");
      team.setPlayers(players);


      private static void setupPlayer(Player player, String position)
      System.out.println("Position: " + position);
      player.setPosition(position);
      System.out.print("Name:");
      player.setName(input.nextLine());
      System.out.print("Jersey Number:");
      player.setJerseyNumber(input.nextInt());
      System.out.print("Height:");
      player.setHeight(input.nextInt());
      System.out.print("Weight:");
      player.setWeight(input.nextInt());
      System.out.print("Age:");
      player.setAge(input.nextInt());
      input.hasNextLine(); //flush out stream


      private static void play()
      System.out.println("------------------------------------");
      System.out.println(" LET'S PLAY. GOOD LUCK!");
      System.out.println("------------------------------------");
      for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
      System.out.println("Round #" + gameRound);
      pressAnyKey();

      int result = getRandom();
      team.updateScore(result); // update score
      switch (result)
      case 0:
      System.out.println(">>> Sorry, You Lost!");
      break;
      case 1:
      System.out.println(">>> You Win!");
      break;
      case 2:
      System.out.println(">>> It's a Tie!");
      break;


      clearScreen();


      private static void pressAnyKey()
      System.out.println();
      System.out.println("Press any key to start");
      input.nextLine();


      static void showMainMenu()
      System.out.println("----------------------------------");
      System.out.println(" NFL GAME");
      System.out.println("----------------------------------");
      System.out.println("(1) Play");
      System.out.println("(2) Create New Team");
      System.out.println("(3) Update Team");
      System.out.println("(4) Display Team Stats");
      System.out.println("(5) Display Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


      static void showUpdateMenu()
      System.out.println("----------------------------------");
      System.out.println(" TEAM UPDATE");
      System.out.println("----------------------------------");
      System.out.println("(1) Edit Team Name");
      System.out.println("(2) Edit Owner");
      System.out.println("(3) Edit Coach");
      System.out.println("(4) Edit Team Stats");
      System.out.println("(5) Edit Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




      > static void updateTeam()
      >
      >
      >
      > static void processUpdate()
      >
      >


      static void editPlayers()
      System.out.println();
      System.out.print("Enter new Players name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Players Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editCoach()
      System.out.println();
      System.out.print("Enter new Coach name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Coach Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editOwner()
      System.out.println();
      System.out.print("Enter new Owner name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Owner Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);




      private static void editTeam()
      System.out.println();
      System.out.print("Enter new team name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.equals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Name Edited! **");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      public static int getRandom()
      return new Random().nextInt(2);


      }


      }












      share|improve this question







      New contributor




      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I need help with the area I think I highlighted with arrows (static void updateTeam & processUpdate)
      Suppose to output a game where you type in a team and it will out put win, loss, and ties.






      package nfl.game;

      import java.util.Random;
      import java.util.Scanner;

      public class Game
      final static int GAME_PLAY = 5;
      static Team team;
      static Scanner input = new Scanner(System.in);
      static int gameRound = 0;
      final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
      final static String CREATE_ERR_MSG = "Team is already created.";
      final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
      final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
      final static String STATS_ERR_MSG = "No stats available. Create a team first.";
      final static String INVALID_ERR_MSG = "Invalid input. Try again.";

      public static void main(String[] args)
      char choice = ' ';
      boolean done = false;
      do
      do
      showMainMenu();
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
      showError(INVALID_ERR_MSG);
      pressAnyKey();
      else
      done = true;

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      while (!done);

      while (processSelection(choice));

      public static void clearScreen()
      for (int i = 0; i < 7; System.out.println(), i++)
      ;

      private static void showError(String message)
      System.out.println("n>>>> " + message + " <<<<n");

      private static boolean processSelection(char choice)
      switch (choice)
      case '1': // Play game
      if (team != null)
      if (gameRound >=5)
      System.out.print("Play Again (Y/N)?");
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice == 'Y')
      gameRound = 0;
      team.setScores(new int[] 0, 0, 0 );
      play();

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      else
      play();

      else
      showError(PLAY_ERR_MSG);
      break;
      case '2': // Create Team
      if (team == null)
      createTeam();
      else
      showError(CREATE_ERR_MSG);
      break;
      case '3': //Update Team
      if (team != null)
      updateTeam();
      else
      showError(UPDATE_ERR_MSG);
      break;
      case '4': //Display Stats
      if (team != null)
      displayStats();
      else
      showError(STATS_ERR_MSG);
      break;
      case '5': // Show Roster
      if (team != null)
      showRoster();
      else
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      quit();
      break;

      pressAnyKey();
      return true;


      private static void showRoster()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM ROSTER");
      System.out.println("-----------------------------------------------");
      team.showRoster();


      private static void quit()
      System.out.println();
      System.out.println("-------------------------------------");
      System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
      System.out.println("-------------------------------------");
      System.exit(0);


      private static void displayStats()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM STATISTICS");
      System.out.println("----------------------------------------------------");
      team.showTeamStats();



      private static void createTeam()
      team = new Team();
      System.out.println();
      System.out.println("-------------------------------------------------");
      System.out.println(" Let's Create Your Team");
      System.out.println("-------------------------------------------------");
      System.out.println();
      System.out.print("Team Name: ");
      team.setName(input.nextLine());
      System.out.print("Owner Name: ");
      team.setOwner(input.nextLine());
      System.out.print("Head Coach: ");
      team.setCoach(input.nextLine());
      System.out.println();
      setSide();
      team.setSide("Offensive");
      System.out.println(" ** Team Created! **");


      private static void setSide()
      char choice;
      do
      System.out.print("(1) Defensive or (2) Offensive: ");
      choice = input.nextLine().charAt(0);
      while (choice != '1' && choice != '2');

      if (choice == '1')
      setupDefensiveTeam();
      else
      setupOffensiveTeam();



      private static void setupOffensiveTeam()
      Player[] players = new Player[6];
      for (int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Offensive");
      setupPlayer(players[0], "Quarterback");
      setupPlayer(players[1], "Wide Receiver");
      setupPlayer(players[2], "Wide Receiver");
      setupPlayer(players[3], "Offensive Guard");
      setupPlayer(players[4], "Offensive Guard");
      setupPlayer(players[5], "Center");


      private static void setupDefensiveTeam()
      Player[] players = new Player[6];
      for(int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Defensive");
      setupPlayer(players[0], "Safety");
      setupPlayer(players[1], "Cornerback");
      setupPlayer(players[2], "Cornerback");
      setupPlayer(players[3], "Defensive Tackle");
      setupPlayer(players[4], "Defensive Tackle");
      setupPlayer(players[5], "Middle Linebacker");
      team.setPlayers(players);


      private static void setupPlayer(Player player, String position)
      System.out.println("Position: " + position);
      player.setPosition(position);
      System.out.print("Name:");
      player.setName(input.nextLine());
      System.out.print("Jersey Number:");
      player.setJerseyNumber(input.nextInt());
      System.out.print("Height:");
      player.setHeight(input.nextInt());
      System.out.print("Weight:");
      player.setWeight(input.nextInt());
      System.out.print("Age:");
      player.setAge(input.nextInt());
      input.hasNextLine(); //flush out stream


      private static void play()
      System.out.println("------------------------------------");
      System.out.println(" LET'S PLAY. GOOD LUCK!");
      System.out.println("------------------------------------");
      for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
      System.out.println("Round #" + gameRound);
      pressAnyKey();

      int result = getRandom();
      team.updateScore(result); // update score
      switch (result)
      case 0:
      System.out.println(">>> Sorry, You Lost!");
      break;
      case 1:
      System.out.println(">>> You Win!");
      break;
      case 2:
      System.out.println(">>> It's a Tie!");
      break;


      clearScreen();


      private static void pressAnyKey()
      System.out.println();
      System.out.println("Press any key to start");
      input.nextLine();


      static void showMainMenu()
      System.out.println("----------------------------------");
      System.out.println(" NFL GAME");
      System.out.println("----------------------------------");
      System.out.println("(1) Play");
      System.out.println("(2) Create New Team");
      System.out.println("(3) Update Team");
      System.out.println("(4) Display Team Stats");
      System.out.println("(5) Display Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


      static void showUpdateMenu()
      System.out.println("----------------------------------");
      System.out.println(" TEAM UPDATE");
      System.out.println("----------------------------------");
      System.out.println("(1) Edit Team Name");
      System.out.println("(2) Edit Owner");
      System.out.println("(3) Edit Coach");
      System.out.println("(4) Edit Team Stats");
      System.out.println("(5) Edit Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




      > static void updateTeam()
      >
      >
      >
      > static void processUpdate()
      >
      >


      static void editPlayers()
      System.out.println();
      System.out.print("Enter new Players name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Players Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editCoach()
      System.out.println();
      System.out.print("Enter new Coach name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Coach Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editOwner()
      System.out.println();
      System.out.print("Enter new Owner name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Owner Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);




      private static void editTeam()
      System.out.println();
      System.out.print("Enter new team name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.equals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Name Edited! **");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      public static int getRandom()
      return new Random().nextInt(2);


      }


      }








      package nfl.game;

      import java.util.Random;
      import java.util.Scanner;

      public class Game
      final static int GAME_PLAY = 5;
      static Team team;
      static Scanner input = new Scanner(System.in);
      static int gameRound = 0;
      final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
      final static String CREATE_ERR_MSG = "Team is already created.";
      final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
      final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
      final static String STATS_ERR_MSG = "No stats available. Create a team first.";
      final static String INVALID_ERR_MSG = "Invalid input. Try again.";

      public static void main(String[] args)
      char choice = ' ';
      boolean done = false;
      do
      do
      showMainMenu();
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
      showError(INVALID_ERR_MSG);
      pressAnyKey();
      else
      done = true;

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      while (!done);

      while (processSelection(choice));

      public static void clearScreen()
      for (int i = 0; i < 7; System.out.println(), i++)
      ;

      private static void showError(String message)
      System.out.println("n>>>> " + message + " <<<<n");

      private static boolean processSelection(char choice)
      switch (choice)
      case '1': // Play game
      if (team != null)
      if (gameRound >=5)
      System.out.print("Play Again (Y/N)?");
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice == 'Y')
      gameRound = 0;
      team.setScores(new int[] 0, 0, 0 );
      play();

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      else
      play();

      else
      showError(PLAY_ERR_MSG);
      break;
      case '2': // Create Team
      if (team == null)
      createTeam();
      else
      showError(CREATE_ERR_MSG);
      break;
      case '3': //Update Team
      if (team != null)
      updateTeam();
      else
      showError(UPDATE_ERR_MSG);
      break;
      case '4': //Display Stats
      if (team != null)
      displayStats();
      else
      showError(STATS_ERR_MSG);
      break;
      case '5': // Show Roster
      if (team != null)
      showRoster();
      else
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      quit();
      break;

      pressAnyKey();
      return true;


      private static void showRoster()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM ROSTER");
      System.out.println("-----------------------------------------------");
      team.showRoster();


      private static void quit()
      System.out.println();
      System.out.println("-------------------------------------");
      System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
      System.out.println("-------------------------------------");
      System.exit(0);


      private static void displayStats()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM STATISTICS");
      System.out.println("----------------------------------------------------");
      team.showTeamStats();



      private static void createTeam()
      team = new Team();
      System.out.println();
      System.out.println("-------------------------------------------------");
      System.out.println(" Let's Create Your Team");
      System.out.println("-------------------------------------------------");
      System.out.println();
      System.out.print("Team Name: ");
      team.setName(input.nextLine());
      System.out.print("Owner Name: ");
      team.setOwner(input.nextLine());
      System.out.print("Head Coach: ");
      team.setCoach(input.nextLine());
      System.out.println();
      setSide();
      team.setSide("Offensive");
      System.out.println(" ** Team Created! **");


      private static void setSide()
      char choice;
      do
      System.out.print("(1) Defensive or (2) Offensive: ");
      choice = input.nextLine().charAt(0);
      while (choice != '1' && choice != '2');

      if (choice == '1')
      setupDefensiveTeam();
      else
      setupOffensiveTeam();



      private static void setupOffensiveTeam()
      Player[] players = new Player[6];
      for (int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Offensive");
      setupPlayer(players[0], "Quarterback");
      setupPlayer(players[1], "Wide Receiver");
      setupPlayer(players[2], "Wide Receiver");
      setupPlayer(players[3], "Offensive Guard");
      setupPlayer(players[4], "Offensive Guard");
      setupPlayer(players[5], "Center");


      private static void setupDefensiveTeam()
      Player[] players = new Player[6];
      for(int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Defensive");
      setupPlayer(players[0], "Safety");
      setupPlayer(players[1], "Cornerback");
      setupPlayer(players[2], "Cornerback");
      setupPlayer(players[3], "Defensive Tackle");
      setupPlayer(players[4], "Defensive Tackle");
      setupPlayer(players[5], "Middle Linebacker");
      team.setPlayers(players);


      private static void setupPlayer(Player player, String position)
      System.out.println("Position: " + position);
      player.setPosition(position);
      System.out.print("Name:");
      player.setName(input.nextLine());
      System.out.print("Jersey Number:");
      player.setJerseyNumber(input.nextInt());
      System.out.print("Height:");
      player.setHeight(input.nextInt());
      System.out.print("Weight:");
      player.setWeight(input.nextInt());
      System.out.print("Age:");
      player.setAge(input.nextInt());
      input.hasNextLine(); //flush out stream


      private static void play()
      System.out.println("------------------------------------");
      System.out.println(" LET'S PLAY. GOOD LUCK!");
      System.out.println("------------------------------------");
      for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
      System.out.println("Round #" + gameRound);
      pressAnyKey();

      int result = getRandom();
      team.updateScore(result); // update score
      switch (result)
      case 0:
      System.out.println(">>> Sorry, You Lost!");
      break;
      case 1:
      System.out.println(">>> You Win!");
      break;
      case 2:
      System.out.println(">>> It's a Tie!");
      break;


      clearScreen();


      private static void pressAnyKey()
      System.out.println();
      System.out.println("Press any key to start");
      input.nextLine();


      static void showMainMenu()
      System.out.println("----------------------------------");
      System.out.println(" NFL GAME");
      System.out.println("----------------------------------");
      System.out.println("(1) Play");
      System.out.println("(2) Create New Team");
      System.out.println("(3) Update Team");
      System.out.println("(4) Display Team Stats");
      System.out.println("(5) Display Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


      static void showUpdateMenu()
      System.out.println("----------------------------------");
      System.out.println(" TEAM UPDATE");
      System.out.println("----------------------------------");
      System.out.println("(1) Edit Team Name");
      System.out.println("(2) Edit Owner");
      System.out.println("(3) Edit Coach");
      System.out.println("(4) Edit Team Stats");
      System.out.println("(5) Edit Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




      > static void updateTeam()
      >
      >
      >
      > static void processUpdate()
      >
      >


      static void editPlayers()
      System.out.println();
      System.out.print("Enter new Players name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Players Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editCoach()
      System.out.println();
      System.out.print("Enter new Coach name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Coach Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editOwner()
      System.out.println();
      System.out.print("Enter new Owner name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Owner Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);




      private static void editTeam()
      System.out.println();
      System.out.print("Enter new team name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.equals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Name Edited! **");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      public static int getRandom()
      return new Random().nextInt(2);


      }


      }





      package nfl.game;

      import java.util.Random;
      import java.util.Scanner;

      public class Game
      final static int GAME_PLAY = 5;
      static Team team;
      static Scanner input = new Scanner(System.in);
      static int gameRound = 0;
      final static String PLAY_ERR_MSG = "Can not play. Create a team first.";
      final static String CREATE_ERR_MSG = "Team is already created.";
      final static String UPDATE_ERR_MSG = "Can not update. Create a team first.";
      final static String TEAM_ERR_MSG = "Nothing to show. Create a team first.";
      final static String STATS_ERR_MSG = "No stats available. Create a team first.";
      final static String INVALID_ERR_MSG = "Invalid input. Try again.";

      public static void main(String[] args)
      char choice = ' ';
      boolean done = false;
      do
      do
      showMainMenu();
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' && choice != 'Q')
      showError(INVALID_ERR_MSG);
      pressAnyKey();
      else
      done = true;

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      while (!done);

      while (processSelection(choice));

      public static void clearScreen()
      for (int i = 0; i < 7; System.out.println(), i++)
      ;

      private static void showError(String message)
      System.out.println("n>>>> " + message + " <<<<n");

      private static boolean processSelection(char choice)
      switch (choice)
      case '1': // Play game
      if (team != null)
      if (gameRound >=5)
      System.out.print("Play Again (Y/N)?");
      try
      choice = input.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
      if (choice == 'Y')
      gameRound = 0;
      team.setScores(new int[] 0, 0, 0 );
      play();

      catch (Exception e)
      showError(INVALID_ERR_MSG);


      else
      play();

      else
      showError(PLAY_ERR_MSG);
      break;
      case '2': // Create Team
      if (team == null)
      createTeam();
      else
      showError(CREATE_ERR_MSG);
      break;
      case '3': //Update Team
      if (team != null)
      updateTeam();
      else
      showError(UPDATE_ERR_MSG);
      break;
      case '4': //Display Stats
      if (team != null)
      displayStats();
      else
      showError(STATS_ERR_MSG);
      break;
      case '5': // Show Roster
      if (team != null)
      showRoster();
      else
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      showError(TEAM_ERR_MSG);
      break;
      case 'Q': //Exit Game
      quit();
      break;

      pressAnyKey();
      return true;


      private static void showRoster()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM ROSTER");
      System.out.println("-----------------------------------------------");
      team.showRoster();


      private static void quit()
      System.out.println();
      System.out.println("-------------------------------------");
      System.out.println(" THANKS FOR PLAYING. GOOD-BYE.");
      System.out.println("-------------------------------------");
      System.exit(0);


      private static void displayStats()
      System.out.println();
      System.out.println("----------------------------------------------------");
      System.out.println(" TEAM STATISTICS");
      System.out.println("----------------------------------------------------");
      team.showTeamStats();



      private static void createTeam()
      team = new Team();
      System.out.println();
      System.out.println("-------------------------------------------------");
      System.out.println(" Let's Create Your Team");
      System.out.println("-------------------------------------------------");
      System.out.println();
      System.out.print("Team Name: ");
      team.setName(input.nextLine());
      System.out.print("Owner Name: ");
      team.setOwner(input.nextLine());
      System.out.print("Head Coach: ");
      team.setCoach(input.nextLine());
      System.out.println();
      setSide();
      team.setSide("Offensive");
      System.out.println(" ** Team Created! **");


      private static void setSide()
      char choice;
      do
      System.out.print("(1) Defensive or (2) Offensive: ");
      choice = input.nextLine().charAt(0);
      while (choice != '1' && choice != '2');

      if (choice == '1')
      setupDefensiveTeam();
      else
      setupOffensiveTeam();



      private static void setupOffensiveTeam()
      Player[] players = new Player[6];
      for (int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Offensive");
      setupPlayer(players[0], "Quarterback");
      setupPlayer(players[1], "Wide Receiver");
      setupPlayer(players[2], "Wide Receiver");
      setupPlayer(players[3], "Offensive Guard");
      setupPlayer(players[4], "Offensive Guard");
      setupPlayer(players[5], "Center");


      private static void setupDefensiveTeam()
      Player[] players = new Player[6];
      for(int i = 0; i < Team.MAX_PLAYERS; i++)
      players[i] = new Player();

      team.setSide("Defensive");
      setupPlayer(players[0], "Safety");
      setupPlayer(players[1], "Cornerback");
      setupPlayer(players[2], "Cornerback");
      setupPlayer(players[3], "Defensive Tackle");
      setupPlayer(players[4], "Defensive Tackle");
      setupPlayer(players[5], "Middle Linebacker");
      team.setPlayers(players);


      private static void setupPlayer(Player player, String position)
      System.out.println("Position: " + position);
      player.setPosition(position);
      System.out.print("Name:");
      player.setName(input.nextLine());
      System.out.print("Jersey Number:");
      player.setJerseyNumber(input.nextInt());
      System.out.print("Height:");
      player.setHeight(input.nextInt());
      System.out.print("Weight:");
      player.setWeight(input.nextInt());
      System.out.print("Age:");
      player.setAge(input.nextInt());
      input.hasNextLine(); //flush out stream


      private static void play()
      System.out.println("------------------------------------");
      System.out.println(" LET'S PLAY. GOOD LUCK!");
      System.out.println("------------------------------------");
      for (gameRound = 1; gameRound <= GAME_PLAY; gameRound++)
      System.out.println("Round #" + gameRound);
      pressAnyKey();

      int result = getRandom();
      team.updateScore(result); // update score
      switch (result)
      case 0:
      System.out.println(">>> Sorry, You Lost!");
      break;
      case 1:
      System.out.println(">>> You Win!");
      break;
      case 2:
      System.out.println(">>> It's a Tie!");
      break;


      clearScreen();


      private static void pressAnyKey()
      System.out.println();
      System.out.println("Press any key to start");
      input.nextLine();


      static void showMainMenu()
      System.out.println("----------------------------------");
      System.out.println(" NFL GAME");
      System.out.println("----------------------------------");
      System.out.println("(1) Play");
      System.out.println("(2) Create New Team");
      System.out.println("(3) Update Team");
      System.out.println("(4) Display Team Stats");
      System.out.println("(5) Display Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");


      static void showUpdateMenu()
      System.out.println("----------------------------------");
      System.out.println(" TEAM UPDATE");
      System.out.println("----------------------------------");
      System.out.println("(1) Edit Team Name");
      System.out.println("(2) Edit Owner");
      System.out.println("(3) Edit Coach");
      System.out.println("(4) Edit Team Stats");
      System.out.println("(5) Edit Roster");
      System.out.println("(Q) Exit");

      System.out.print("nSelection (1, 2, 3, 4, 5, Q):");




      > static void updateTeam()
      >
      >
      >
      > static void processUpdate()
      >
      >


      static void editPlayers()
      System.out.println();
      System.out.print("Enter new Players name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Players Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editCoach()
      System.out.println();
      System.out.print("Enter new Coach name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Coach Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      private static void editOwner()
      System.out.println();
      System.out.print("Enter new Owner name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.contentEquals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Owner Edited! ** ");

      catch (Exception e)
      showError(INVALID_ERR_MSG);




      private static void editTeam()
      System.out.println();
      System.out.print("Enter new team name or (999 to cancel): ");
      try
      String temp = input.nextLine();
      if (!temp.equals("999") && temp.length()>0)
      team.setName(temp);
      System.out.println(" ** Team Name Edited! **");

      catch (Exception e)
      showError(INVALID_ERR_MSG);



      public static int getRandom()
      return new Random().nextInt(2);


      }


      }






      java






      share|improve this question







      New contributor




      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 17 mins ago









      podsednik1podsednik1

      11




      11




      New contributor




      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      podsednik1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "196"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          podsednik1 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217514%2ftrying-to-output-a-game%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          podsednik1 is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          podsednik1 is a new contributor. Be nice, and check out our Code of Conduct.












          podsednik1 is a new contributor. Be nice, and check out our Code of Conduct.











          podsednik1 is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217514%2ftrying-to-output-a-game%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

          格濟夫卡 參考資料 导航菜单51°3′40″N 34°2′21″E / 51.06111°N 34.03917°E / 51.06111; 34.03917ГезівкаПогода в селі 编辑或修订