tambo2199

FantaCalcio

Jan 7th, 2019 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace fantacalcio
  8. {
  9.     class Mercato
  10.     {
  11.         List<Giocatore> giocatori;
  12.  
  13.         public Mercato()
  14.         {
  15.             giocatori = new List<Giocatore>();
  16.         }
  17.  
  18.         public void Newslegato()
  19.         {
  20.             Console.WriteLine("inserisci il nome, il cognome, il ruolo, il prezzo e il codice del nuovo giocatore\n");
  21.             giocatori.Add(new Giocatore(Console.ReadLine(), Console.ReadLine(), Console.ReadLine(), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine())));
  22.         }
  23.  
  24.         public void StampaMerc()
  25.         {
  26.             foreach (Giocatore g in giocatori)
  27.                 Console.WriteLine(g);
  28.         }
  29.  
  30.         public Giocatore Ricerca()
  31.         {
  32.             string s;
  33.             Giocatore gio;
  34.  
  35.             Console.WriteLine("inserisci il cognome del giocatore che vuoi comprare  ");
  36.             s = Console.ReadLine();
  37.             gio = giocatori.Find(x => x.Cognome.Equals(s));
  38.             return gio;
  39.         }
  40.  
  41.         public void Rimuovi(Giocatore g)
  42.         {
  43.             giocatori.Remove(g);
  44.         }
  45.  
  46.         public void AddMercato(Giocatore g)
  47.         {
  48.             giocatori.Add(g);
  49.         }
  50.     }
  51. }
Add Comment
Please, Sign In to add comment