oggetti_2/Squadra.cs
La Programmatrice Verde d6b251aae7 Concluso
2025-04-05 11:54:10 +02:00

79 lines
3.1 KiB
C#

namespace oggetti_2;
class Squadra {
public readonly Calciatore[] giocatori;
readonly Calciatore capitano;
readonly Calciatore centrocampista;
readonly Calciatore attaccanteDestro;
readonly Calciatore attaccanteSinistro;
readonly Calciatore esternoDestro;
readonly Calciatore esternoSinistro;
readonly Calciatore terzinoDestro;
readonly Calciatore terzinoSinistro;
readonly Calciatore difensore;
readonly Calciatore portiere;
readonly string name;
readonly string location;
readonly double budget;
readonly int matchesWon;
readonly int matchesLost;
public Squadra(Calciatore capitano, Calciatore centrocampista, Calciatore attaccanteDestro, Calciatore attaccanteSinistro, Calciatore esternoDestro, Calciatore esternoSinistro, Calciatore terzinoDestro, Calciatore terzinoSinistro, Calciatore difensore, Calciatore portiere, string name, string location, double budget, int matchesWon, int matchesLost) {
this.capitano = capitano;
this.centrocampista = centrocampista;
this.attaccanteDestro = attaccanteDestro;
this.attaccanteSinistro = attaccanteSinistro;
this.esternoDestro = esternoDestro;
this.esternoSinistro = esternoSinistro;
this.terzinoDestro = terzinoDestro;
this.terzinoSinistro = terzinoSinistro;
this.difensore = difensore;
this.portiere = portiere;
this.name = name;
this.location = location;
this.budget = budget;
this.matchesWon = matchesWon;
this.matchesLost = matchesLost;
this.giocatori = new Calciatore[10];
this.giocatori[0] = capitano;
this.giocatori[1] = centrocampista;
this.giocatori[2] = attaccanteDestro;
this.giocatori[3] = attaccanteSinistro;
this.giocatori[4] = esternoDestro;
this.giocatori[5] = esternoSinistro;
this.giocatori[6] = terzinoDestro;
this.giocatori[7] = terzinoSinistro;
this.giocatori[8] = difensore;
this.giocatori[9] = portiere;
}
public void MostraSquadra() {
Console.WriteLine($"Nome: {this.name}");
Console.WriteLine($"Luogo: {this.location}");
Console.WriteLine($"Budget: {this.budget}");
Console.WriteLine($"Partite vinte: {this.matchesWon}");
Console.WriteLine($"Partite perse: {this.matchesLost}");
Console.WriteLine("Giocatori:");
Console.WriteLine();
this.capitano.MostraCalciatore();
Console.WriteLine();
this.centrocampista.MostraCalciatore();
Console.WriteLine();
this.attaccanteDestro.MostraCalciatore();
Console.WriteLine();
this.attaccanteSinistro.MostraCalciatore();
Console.WriteLine();
this.esternoDestro.MostraCalciatore();
Console.WriteLine();
this.esternoSinistro.MostraCalciatore();
Console.WriteLine();
this.terzinoDestro.MostraCalciatore();
Console.WriteLine();
this.terzinoSinistro.MostraCalciatore();
Console.WriteLine();
this.difensore.MostraCalciatore();
Console.WriteLine();
this.portiere.MostraCalciatore();
}
}