tambo2199

FantaCalcio

Jan 7th, 2019 (edited)
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 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 Squadra
  10.     {
  11.         public string Nome { get; set; }
  12.         public int Budget { get; set; }
  13.         List<Giocatore> professionisti;
  14.  
  15.         public Squadra()
  16.         {
  17.             professionisti = new List<Giocatore>();
  18.         }
  19.  
  20.         public void Newsquadra()
  21.         {
  22.             Console.WriteLine("Inserisci il nome della tua squadra  ");
  23.             Nome = Console.ReadLine();
  24.             Console.Clear();
  25.             Console.WriteLine("Inserisci il budget  ");
  26.             Budget = Convert.ToInt32(Console.ReadLine());
  27.         }
  28.  
  29.         public void CompraG(Giocatore g)
  30.         {
  31.             professionisti.Add(g);
  32.         }
  33.  
  34.         public Giocatore RicercaS()
  35.         {
  36.             string s;
  37.             Giocatore g;
  38.  
  39.             Console.WriteLine("inserisci il cognome del giocatore che vuoi comprare  ");
  40.             s = Console.ReadLine();
  41.             g = professionisti.Find(x => x.Cognome.Equals(s));
  42.             return g;
  43.         }
  44.  
  45.         public void MostraS()
  46.         {
  47.             Console.WriteLine("Hai chiamato la tua squadra {0} e il tuo budget e' {1}", Nome, Budget);
  48.         }
  49.  
  50.         public void Mostra()
  51.         {
  52.             Console.WriteLine("SQUADRA: {0}  BUDGET: {1}", Nome, Budget);
  53.         }
  54.  
  55.         public void Stampa()
  56.         {
  57.             foreach(Giocatore g in professionisti)
  58.                 Console.WriteLine(g);
  59.            
  60.         }
  61.  
  62.         public void RimuoviS(Giocatore g)
  63.         {
  64.             professionisti.Remove(g);
  65.         }
  66.     }
  67. }
Add Comment
Please, Sign In to add comment