diff --git a/Giocatore.cs b/Giocatore.cs
index 7dbb771..ae3897f 100644
--- a/Giocatore.cs
+++ b/Giocatore.cs
@@ -1,5 +1,65 @@
namespace squadre_calcio;
class Giocatore {
+ string nome;
+ string cognome;
+ string eta;
+ string nomeRuolo;
+ string numeroMaglia;
+ public Giocatore(string p_nome, string p_cognome, string p_eta, string p_nomeRuolo, string p_numeroMaglia) {
+ this.nome = p_nome;
+ this.cognome = p_cognome;
+ this.eta = p_eta;
+ this.nomeRuolo = p_nomeRuolo;
+ this.numeroMaglia = p_numeroMaglia;
+ }
+
+ public string GetNome() {
+ return nome;
+ }
+
+ public string GetCognome() {
+ return cognome;
+ }
+
+ public string GetEta() {
+ return eta;
+ }
+
+ public string GetNomeRuolo() {
+ return nomeRuolo;
+ }
+
+ public string GetNumeroMaglia() {
+ return numeroMaglia;
+ }
+
+ public void SetNome(string p_nome) {
+ this.nome = p_nome;
+ }
+
+ public void SetCognome(string p_cognome) {
+ this.cognome = p_cognome;
+ }
+
+ public void SetEta(string p_eta) {
+ this.eta = p_eta;
+ }
+
+ public void SetNomeRuolo(string p_nomeRuolo) {
+ this.nomeRuolo = p_nomeRuolo;
+ }
+
+ public void SetNumeroMaglia(string p_numeroMaglia) {
+ this.numeroMaglia = p_numeroMaglia;
+ }
+
+ public void StampaGiocatore() {
+ Console.WriteLine($"Nome: {this.GetNome()}");
+ Console.WriteLine($"Cognome: {this.GetCognome()}");
+ Console.WriteLine($"Età: {this.GetEta()}");
+ Console.WriteLine($"Ruolo: {this.GetNomeRuolo()}");
+ Console.WriteLine($"Numero maglia: {this.GetNumeroMaglia()}");
+ }
}
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
index 4b61046..2875b23 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,9 +1,242 @@
-namespace squadre_calcio;
+using System.Net.NetworkInformation;
-class Program
-{
- static void Main(string[] args)
- {
- Console.WriteLine("Hello, World!");
+namespace squadre_calcio;
+
+class Program {
+ static void Main(string[] args) {
+ Console.Clear();
+ int scelta;
+ Squadra[] squadre = null;
+ do {
+ Console.WriteLine("Scegliere un'opzione:");
+ Console.WriteLine("1. Inserisci un array di squadre");
+ Console.WriteLine("2. Stampa formazione di una squadra");
+ Console.WriteLine("3. Stampa tutte le squadre");
+ Console.WriteLine("4. Pulisci schermo");
+ Console.WriteLine("0. Esci");
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+
+ switch (scelta) {
+ case 0:
+ break;
+ case 1:
+ squadre = CreaArraySquadre();
+ Pausa();
+ break;
+ case 2:
+ if (squadre == null) {
+ Console.WriteLine("Errore: è necessario creare l'array di squadre prima di poter stampare la formazione di una squadra");
+ }
+ else {
+ do {
+ Console.WriteLine("Per quale parametro scegliere la squadra? ");
+ Console.WriteLine("1. Nome");
+ Console.WriteLine("2. Città");
+ Console.WriteLine("3. Sponsor");
+ Console.WriteLine("4. Numero membri");
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+
+ switch (scelta) {
+ case 1:
+ do {
+ Console.WriteLine("Scegliere un'opzione:");
+ for (int i = 0; i < squadre.Length; i++) {
+ Console.WriteLine($"{i}. {squadre[i].GetNome()}");
+ }
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+ if (scelta < 0 || scelta >= squadre.Length) {
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ }
+ }
+ while (scelta < 0 || scelta >= squadre.Length);
+
+ squadre[scelta].StampaSquadra();
+
+ scelta = -1;
+ break;
+ case 2:
+ do {
+ Console.WriteLine("Scegliere un'opzione:");
+ for (int i = 0; i < squadre.Length; i++) {
+ Console.WriteLine($"{i}. {squadre[i].GetCitta()}");
+ }
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+ if (scelta < 0 || scelta >= squadre.Length) {
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ }
+ }
+ while (scelta < 0 || scelta >= squadre.Length);
+
+ squadre[scelta].StampaSquadra();
+
+ scelta = -1;
+ break;
+ case 3:
+ do {
+ Console.WriteLine("Scegliere un'opzione:");
+ for (int i = 0; i < squadre.Length; i++) {
+ Console.WriteLine($"{i}. {squadre[i].GetSponsor()}");
+ }
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+ if (scelta < 0 || scelta >= squadre.Length) {
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ }
+ }
+ while (scelta < 0 || scelta >= squadre.Length);
+
+ squadre[scelta].StampaSquadra();
+
+ scelta = -1;
+ break;
+ case 4:
+ do {
+ Console.WriteLine("Scegliere un'opzione:");
+ for (int i = 0; i < squadre.Length; i++) {
+ Console.WriteLine($"{i}. {squadre[i].GetMembri().Length}");
+ }
+ Console.Write("Scelta: ");
+ scelta = Convert.ToInt32(Console.ReadLine());
+ if (scelta < 0 || scelta >= squadre.Length) {
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ }
+ }
+ while (scelta < 0 || scelta >= squadre.Length);
+
+ squadre[scelta].StampaSquadra();
+
+ scelta = -1;
+ break;
+ default:
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ break;
+ }
+ }
+ while(scelta != -1);
+ }
+ Pausa();
+ break;
+ case 3:
+ Pausa();
+ break;
+ case 4:
+ Console.Clear();
+ break;
+ default:
+ Console.WriteLine("Opzione non valida.");
+ Pausa();
+ break;
+ }
+ }
+ while (scelta != 0);
+ }
+
+ static void Pausa() {
+ Console.WriteLine("Premere un tasto per continuare. . .");
+ Console.ReadKey();
+ }
+
+ static Squadra[] CreaArraySquadre() {
+ Squadra[] ritorno;
+ int input;
+ string nome;
+ string citta;
+ string sponsor;
+ Giocatore[] membri;
+
+
+
+ do {
+ Console.Write("Quante squadre si vuole creare? ");
+ input = Convert.ToInt32(Console.ReadLine());
+ if (input <= 0) {
+ Console.WriteLine("Non è possibile creare meno di una squadra.");
+ Pausa();
+ }
+ }
+ while (input <= 0);
+
+ ritorno = new Squadra[input];
+
+ for (int i = 0; i < ritorno.Length; i++) {
+ Console.WriteLine($"Squadra n. {i + 1}:\n");
+
+ Console.Write("Nome della squadra: ");
+ nome = Console.ReadLine();
+
+ Console.Write("Città della squadra: ");
+ citta = Console.ReadLine();
+
+ Console.Write("Sponsor della squadra: ");
+ sponsor = Console.ReadLine();
+
+
+ membri = CreaArrayGiocatori();
+
+ ritorno[i] = new Squadra(nome, citta, sponsor, membri);
+ }
+ return ritorno;
+ }
+
+ static Giocatore[] CreaArrayGiocatori() {
+ Giocatore[] ritorno;
+ int input;
+ string nome;
+ string cognome;
+ string eta;
+ string nomeRuolo;
+ string numeroMaglia;
+
+ do {
+ Console.Write("Da quanti giocatori è formata la squadra? ");
+ input = Convert.ToInt32(Console.ReadLine());
+ if (input <= 0) {
+ Console.WriteLine("Non è possibile creare una squadra con meno di un giocatore.");
+ Pausa();
+ }
+ }
+ while (input <= 0);
+ ritorno = new Giocatore[input];
+
+ for (int i = 0; i < ritorno.Length; i++) {
+ Console.WriteLine($"Giocatore n. {i + 1}:\n");
+
+ Console.Write("Nome del giocatore: ");
+ nome = Console.ReadLine();
+
+ Console.Write("Cognome del giocatore: ");
+ cognome = Console.ReadLine();
+
+ do {
+ Console.Write("Età del giocatore: ");
+ input = Convert.ToInt32(Console.ReadLine());
+ if (input <= 0) {
+ Console.WriteLine("Non è possibile un giocatore con un'età inferiore a zero.");
+ Pausa();
+ }
+ }
+ while (input <= 0);
+
+ eta = Convert.ToString(input);
+
+ Console.Write("Ruolo del giocatore: ");
+ nomeRuolo = Console.ReadLine();
+
+ Console.Write("Numero di maglia del giocatore: ");
+ numeroMaglia = Convert.ToString(Convert.ToInt32(Console.ReadLine()));
+
+ ritorno[i] = new Giocatore(nome, cognome, eta, nomeRuolo, numeroMaglia);
+ }
+
+ return ritorno;
}
}
diff --git a/Squadra.cs b/Squadra.cs
index 707e8f4..bbc9f65 100644
--- a/Squadra.cs
+++ b/Squadra.cs
@@ -1,5 +1,59 @@
namespace squadre_calcio;
class Squadra {
+ string nome;
+ string citta;
+ string sponsor;
+ Giocatore[] membri;
+ public Squadra(string p_nome, string p_citta, string p_sponsor, Giocatore[] p_membri) {
+ this.nome = p_nome;
+ this.citta = p_citta;
+ this.sponsor = p_sponsor;
+ this.membri = p_membri;
+ }
+
+ public string GetNome() {
+ return this.nome;
+ }
+
+ public string GetCitta() {
+ return this.citta;
+ }
+
+ public string GetSponsor() {
+ return this.sponsor;
+ }
+
+ public Giocatore[] GetMembri() {
+ return this.membri;
+ }
+
+ public void SetNome(string p_nome) {
+ this.nome = p_nome;
+ }
+
+ public void SetCitta(string p_citta) {
+ this.citta = p_citta;
+ }
+
+ public void SetSponsor(string p_sponsor) {
+ this.sponsor = p_sponsor;
+ }
+
+ public void SetMembri(Giocatore[] p_membri) {
+ this.membri = p_membri;
+ }
+
+ public void StampaSquadra() {
+ Console.WriteLine($"Nome squadra: {this.GetNome()}");
+ Console.WriteLine($"Città: {this.GetCitta()}");
+ Console.WriteLine($"Sponsor: {this.GetSponsor()}");
+ Console.WriteLine("Giocatori:\n");
+ for (int i = 0; i < this.membri.Length; i++) {
+ Console.WriteLine($"Giocatore n. {i + 1}");
+ this.membri[i].StampaGiocatore();
+ Console.WriteLine();
+ }
+ }
}
\ No newline at end of file
diff --git a/bin/Debug/net9.0/squadre_calcio b/bin/Debug/net9.0/squadre_calcio
new file mode 100755
index 0000000..7ad6feb
Binary files /dev/null and b/bin/Debug/net9.0/squadre_calcio differ
diff --git a/bin/Debug/net9.0/squadre_calcio.deps.json b/bin/Debug/net9.0/squadre_calcio.deps.json
new file mode 100644
index 0000000..ff4617a
--- /dev/null
+++ b/bin/Debug/net9.0/squadre_calcio.deps.json
@@ -0,0 +1,23 @@
+{
+ "runtimeTarget": {
+ "name": ".NETCoreApp,Version=v9.0",
+ "signature": ""
+ },
+ "compilationOptions": {},
+ "targets": {
+ ".NETCoreApp,Version=v9.0": {
+ "squadre_calcio/1.0.0": {
+ "runtime": {
+ "squadre_calcio.dll": {}
+ }
+ }
+ }
+ },
+ "libraries": {
+ "squadre_calcio/1.0.0": {
+ "type": "project",
+ "serviceable": false,
+ "sha512": ""
+ }
+ }
+}
\ No newline at end of file
diff --git a/bin/Debug/net9.0/squadre_calcio.dll b/bin/Debug/net9.0/squadre_calcio.dll
new file mode 100644
index 0000000..8927d4c
Binary files /dev/null and b/bin/Debug/net9.0/squadre_calcio.dll differ
diff --git a/bin/Debug/net9.0/squadre_calcio.pdb b/bin/Debug/net9.0/squadre_calcio.pdb
new file mode 100644
index 0000000..33d4176
Binary files /dev/null and b/bin/Debug/net9.0/squadre_calcio.pdb differ
diff --git a/bin/Debug/net9.0/squadre_calcio.runtimeconfig.json b/bin/Debug/net9.0/squadre_calcio.runtimeconfig.json
new file mode 100644
index 0000000..b19c3c8
--- /dev/null
+++ b/bin/Debug/net9.0/squadre_calcio.runtimeconfig.json
@@ -0,0 +1,12 @@
+{
+ "runtimeOptions": {
+ "tfm": "net9.0",
+ "framework": {
+ "name": "Microsoft.NETCore.App",
+ "version": "9.0.0"
+ },
+ "configProperties": {
+ "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs b/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs
new file mode 100644
index 0000000..9e76325
--- /dev/null
+++ b/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs
@@ -0,0 +1,4 @@
+//
+using System;
+using System.Reflection;
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
diff --git a/obj/Debug/net9.0/apphost b/obj/Debug/net9.0/apphost
new file mode 100755
index 0000000..7ad6feb
Binary files /dev/null and b/obj/Debug/net9.0/apphost differ
diff --git a/obj/Debug/net9.0/ref/squadre_calcio.dll b/obj/Debug/net9.0/ref/squadre_calcio.dll
new file mode 100644
index 0000000..0563aca
Binary files /dev/null and b/obj/Debug/net9.0/ref/squadre_calcio.dll differ
diff --git a/obj/Debug/net9.0/refint/squadre_calcio.dll b/obj/Debug/net9.0/refint/squadre_calcio.dll
new file mode 100644
index 0000000..0563aca
Binary files /dev/null and b/obj/Debug/net9.0/refint/squadre_calcio.dll differ
diff --git a/obj/Debug/net9.0/squadre_calcio.AssemblyInfo.cs b/obj/Debug/net9.0/squadre_calcio.AssemblyInfo.cs
new file mode 100644
index 0000000..6088f24
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.AssemblyInfo.cs
@@ -0,0 +1,22 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Reflection;
+
+[assembly: System.Reflection.AssemblyCompanyAttribute("squadre_calcio")]
+[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
+[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4a6a5d98b347235812fddc8fff8aea7d75c30d50")]
+[assembly: System.Reflection.AssemblyProductAttribute("squadre_calcio")]
+[assembly: System.Reflection.AssemblyTitleAttribute("squadre_calcio")]
+[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
+
+// Generated by the MSBuild WriteCodeFragment class.
+
diff --git a/obj/Debug/net9.0/squadre_calcio.AssemblyInfoInputs.cache b/obj/Debug/net9.0/squadre_calcio.AssemblyInfoInputs.cache
new file mode 100644
index 0000000..bc5f012
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.AssemblyInfoInputs.cache
@@ -0,0 +1 @@
+5f326c6e53b8d89f60c9948ebaf50f7c5d8d2489f1b66dea8290c4496d402d9b
diff --git a/obj/Debug/net9.0/squadre_calcio.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/squadre_calcio.GeneratedMSBuildEditorConfig.editorconfig
new file mode 100644
index 0000000..1a7f2e1
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.GeneratedMSBuildEditorConfig.editorconfig
@@ -0,0 +1,15 @@
+is_global = true
+build_property.TargetFramework = net9.0
+build_property.TargetPlatformMinVersion =
+build_property.UsingMicrosoftNETSdkWeb =
+build_property.ProjectTypeGuids =
+build_property.InvariantGlobalization =
+build_property.PlatformNeutralAssembly =
+build_property.EnforceExtendedAnalyzerRules =
+build_property._SupportedPlatformList = Linux,macOS,Windows
+build_property.RootNamespace = squadre_calcio
+build_property.ProjectDir = /home/Verde/git/squadre_calcio/
+build_property.EnableComHosting =
+build_property.EnableGeneratedComInterfaceComImportInterop =
+build_property.EffectiveAnalysisLevelStyle = 9.0
+build_property.EnableCodeStyleSeverity =
diff --git a/obj/Debug/net9.0/squadre_calcio.GlobalUsings.g.cs b/obj/Debug/net9.0/squadre_calcio.GlobalUsings.g.cs
new file mode 100644
index 0000000..8578f3d
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.GlobalUsings.g.cs
@@ -0,0 +1,8 @@
+//
+global using global::System;
+global using global::System.Collections.Generic;
+global using global::System.IO;
+global using global::System.Linq;
+global using global::System.Net.Http;
+global using global::System.Threading;
+global using global::System.Threading.Tasks;
diff --git a/obj/Debug/net9.0/squadre_calcio.assets.cache b/obj/Debug/net9.0/squadre_calcio.assets.cache
new file mode 100644
index 0000000..7dd3249
Binary files /dev/null and b/obj/Debug/net9.0/squadre_calcio.assets.cache differ
diff --git a/obj/Debug/net9.0/squadre_calcio.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/squadre_calcio.csproj.CoreCompileInputs.cache
new file mode 100644
index 0000000..276c8b6
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.csproj.CoreCompileInputs.cache
@@ -0,0 +1 @@
+76fe8bd22e03fb5b2ef7901ea2da8c1eed12fb460798b5df830373453934eedc
diff --git a/obj/Debug/net9.0/squadre_calcio.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/squadre_calcio.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..da04486
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.csproj.FileListAbsolute.txt
@@ -0,0 +1,14 @@
+/home/Verde/git/squadre_calcio/bin/Debug/net9.0/squadre_calcio
+/home/Verde/git/squadre_calcio/bin/Debug/net9.0/squadre_calcio.deps.json
+/home/Verde/git/squadre_calcio/bin/Debug/net9.0/squadre_calcio.runtimeconfig.json
+/home/Verde/git/squadre_calcio/bin/Debug/net9.0/squadre_calcio.dll
+/home/Verde/git/squadre_calcio/bin/Debug/net9.0/squadre_calcio.pdb
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.GeneratedMSBuildEditorConfig.editorconfig
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.AssemblyInfoInputs.cache
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.AssemblyInfo.cs
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.csproj.CoreCompileInputs.cache
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.dll
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/refint/squadre_calcio.dll
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.pdb
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/squadre_calcio.genruntimeconfig.cache
+/home/Verde/git/squadre_calcio/obj/Debug/net9.0/ref/squadre_calcio.dll
diff --git a/obj/Debug/net9.0/squadre_calcio.dll b/obj/Debug/net9.0/squadre_calcio.dll
new file mode 100644
index 0000000..8927d4c
Binary files /dev/null and b/obj/Debug/net9.0/squadre_calcio.dll differ
diff --git a/obj/Debug/net9.0/squadre_calcio.genruntimeconfig.cache b/obj/Debug/net9.0/squadre_calcio.genruntimeconfig.cache
new file mode 100644
index 0000000..ec94fa6
--- /dev/null
+++ b/obj/Debug/net9.0/squadre_calcio.genruntimeconfig.cache
@@ -0,0 +1 @@
+acd6e17b0b38b627e410db35696bc694906eaca38ef9d5a46667d24df5053cf9
diff --git a/obj/Debug/net9.0/squadre_calcio.pdb b/obj/Debug/net9.0/squadre_calcio.pdb
new file mode 100644
index 0000000..33d4176
Binary files /dev/null and b/obj/Debug/net9.0/squadre_calcio.pdb differ