Advertisement
Montoya-Romina-Anahi

Tp4(7)Main

Jul 7th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. import java.text.ParseException;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import java.util.Scanner;
  5. public class main {
  6.  
  7.  
  8. public static void main(String[] args)throws ParseException {
  9.  
  10.  
  11.  
  12.  
  13. Scanner sc=new Scanner(System.in);
  14. ListaEquipo ListaEquipo= new ListaEquipo();
  15. Equipo temp= new Equipo();
  16. int opcion=1;
  17.  
  18. ;
  19.  
  20. do {
  21. System.out.println("\nOpciones ");
  22. System.out.println("1-AGREGAR EQUIPOS");
  23. System.out.println("2-Equipo ganador");
  24. System.out.println("3-Equipo en ultimo lugar: menor cantidad de presas");
  25. System.out.println("4- Equipo con mejor integrantes con mayor presa");
  26. System.out.println("5-Mostrar");
  27. System.out.println("6-Salir");
  28. System.out.println("Ingrese su eleccion");
  29.  
  30.  
  31. opcion=sc.nextInt();
  32.  
  33. switch (opcion) {
  34. case 1:
  35. temp = CrearEquipo();
  36. ListaEquipo.addFirst(temp);
  37.  
  38. break;
  39. case 2:
  40. System.out.println("Equipo ganador: " ) ;
  41.  
  42. break;
  43. case 3:
  44. System.out.println("Equipo: ");
  45.  
  46. break;
  47. case 4:
  48. System.out.println("Equipo con menor integrantes: ");
  49. break;
  50. case 5:
  51. ListaEquipo.Mostrar();
  52. break;
  53.  
  54. default:
  55. break;
  56. }
  57.  
  58.  
  59. }while(opcion!=5);
  60.  
  61.  
  62.  
  63. sc.close();
  64.  
  65. }
  66. private boolean ValidarIntegrantes(int integrantes){
  67. return (integrantes >= 3 && integrantes <=5);
  68. }
  69. private boolean ValidarPresas(int presas){
  70. return (presas >= 0);
  71. }
  72. private static Equipo CrearEquipo() {
  73.  
  74. Scanner sc1=new Scanner(System.in);
  75.  
  76. Equipo unEquipo = new Equipo();
  77.  
  78. System.out.println("Datos del equipo");
  79. System.out.println("INGRESE nombre del equipo");
  80. String nom=sc1.next();
  81. unEquipo.setnEquipo(nom);
  82.  
  83. System.out.println("INGRESE cantidad de integrantes ");
  84. System.out.println("Min. 3 y Max. 5 ");
  85.  
  86. int can= sc1.nextInt();
  87. unEquipo.setcIntegrantes(can);
  88. System.out.println("Ingrese la cantidad de presas obtenidas");
  89.  
  90. int cant= sc1.nextInt();
  91. unEquipo.setcPresas(cant);
  92. return unEquipo;
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement