Advertisement
Guest User

Untitled

a guest
May 6th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.io.File;
  3. import java.io.FileReader;
  4. import java.util.*;
  5. import javax.swing.*;
  6.  
  7. /**
  8. * Menu class, for providing a menu-based path through the program
  9. *
  10. * @author Kevin Kraydich
  11. * @version 4/22/15
  12. */
  13. public class Menu {
  14. // instance variables
  15. private static ArrayList<Team> team = new ArrayList<Team>();
  16. private static int teamNum;
  17. private static int[] points = new int[8];
  18. private static String s, teamName, out = "";
  19. private static Team t;
  20. private static Scanner in;
  21.  
  22. public static void main(String[] args) throws IOException {
  23. in = new Scanner(new FileReader("program22test.txt"));
  24. while(in.hasNext()){
  25. s = in.nextLine();
  26. String[] vals = s.split(" ");
  27. teamName = vals[0];
  28. teamNum = Integer.parseInt(vals[1]);
  29. for(int i = 0; i < points.length; i++){
  30. points[i] = Integer.parseInt(vals[i + 2]);
  31. }
  32. t = new Team(teamNum, teamName, points);
  33. team.add(t);
  34. }
  35.  
  36. String s = JOptionPane.showInputDialog("How would you like to sort these teams?\n1 = by team name\n2 = by team #\n3 = by average score\n4 = exit program");
  37.  
  38. switch(s){
  39. case "1":
  40.  
  41. case "2":
  42.  
  43. case "3":
  44.  
  45. case "4":
  46.  
  47. default:
  48. for(int i = 0; i < team.size(); i++){
  49. out += team.get(i).toString();
  50. }
  51. JOptionPane.showMessageDialog(null,out);
  52. }
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement