diff --git a/Program.cs b/Program.cs index 37ef7f1..62c2469 100644 --- a/Program.cs +++ b/Program.cs @@ -3,8 +3,8 @@ class Program { static void Main(string[] args) { Console.Clear(); - const int MAX_LIBRI = 10; - int scelta, j; + const int MAX_LIBRI = 2; + int scelta, libroSelezionato = -1; Libro[] biblioteca = new Libro[MAX_LIBRI]; bool oggettoEsistente, nomeEsistente, casaEditriceEsistente; string casaEditrice, nome; @@ -15,6 +15,7 @@ class Program { Console.WriteLine("2. Mostra biblioteca"); Console.WriteLine("3. Mostra libro"); Console.WriteLine("4. Applica sconto"); + Console.WriteLine("5. Pulisci schermo"); Console.WriteLine("0. Esci"); Console.Write("Scelta: "); scelta = Convert.ToInt32(Console.ReadLine()); @@ -70,6 +71,7 @@ class Program { } while (scelta < 0 || scelta > biblioteca.Length); biblioteca[scelta].StampaLibro(); + scelta = int.MaxValue; } Pausa(); break; @@ -86,16 +88,14 @@ class Program { else { Console.WriteLine("Scegliere un nome:"); for (int i = 0; i < biblioteca.Length; i++) { - biblioteca[i].GetNome(); - Console.WriteLine(); + Console.WriteLine($"{biblioteca[i].GetNome()}"); } Console.Write("Nome: "); nome = Console.ReadLine(); Console.WriteLine("Scegliere una casa editrice:"); for (int i = 0; i < biblioteca.Length; i++) { - biblioteca[i].GetCasaEditrice(); - Console.WriteLine(); + Console.WriteLine($"{biblioteca[i].GetCasaEditrice()}"); } Console.Write("Casa editrice: "); casaEditrice = Console.ReadLine(); @@ -103,21 +103,24 @@ class Program { nomeEsistente = false; casaEditriceEsistente = false; - for (j = 0; j < biblioteca.Length && !nomeEsistente && !casaEditriceEsistente; j++) { - nomeEsistente = biblioteca[j].GetNome() == nome; - casaEditriceEsistente = biblioteca[j].GetCasaEditrice() == casaEditrice; + for (int i = 0; i < biblioteca.Length && !nomeEsistente && !casaEditriceEsistente; i++) { + nomeEsistente = biblioteca[i].GetNome() == nome; + casaEditriceEsistente = biblioteca[i].GetCasaEditrice() == casaEditrice; + libroSelezionato = i; } if (!nomeEsistente || !casaEditriceEsistente) { Console.WriteLine($"Nessun libro di nome {nome} di casa editrice {casaEditrice} esistente."); } else { - biblioteca[j].ApplicaSconto(); + biblioteca[libroSelezionato].ApplicaSconto(); + Console.WriteLine("Sconto applicato."); } - } Pausa(); break; - + case 5: + Console.Clear(); + break; default: Console.WriteLine("Opzione non valida."); Pausa(); @@ -146,7 +149,7 @@ class Program { nome = Console.ReadLine(); do { - Console.Write("Inserire il prezzo del libro:"); + Console.Write("Inserire il prezzo del libro: "); prezzo = Convert.ToDouble(Console.ReadLine()); if (prezzo <= 0) { Console.WriteLine("Errore: il prezzo non può essere minore o uguale a zero."); @@ -156,7 +159,7 @@ class Program { while (prezzo <= 0); do { - Console.Write("Inserire il numero di pagine del libro:"); + Console.Write("Inserire il numero di pagine del libro: "); numeroPagine = Convert.ToInt32(Console.ReadLine()); if (numeroPagine <= 0) { Console.WriteLine("Errore: il numero di pagine non può essere minore o uguale a zero."); diff --git a/bin/Debug/net9.0/biblioteca b/bin/Debug/net9.0/biblioteca new file mode 100755 index 0000000..613549a Binary files /dev/null and b/bin/Debug/net9.0/biblioteca differ diff --git a/bin/Debug/net9.0/biblioteca.deps.json b/bin/Debug/net9.0/biblioteca.deps.json new file mode 100644 index 0000000..7e20e42 --- /dev/null +++ b/bin/Debug/net9.0/biblioteca.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v9.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v9.0": { + "biblioteca/1.0.0": { + "runtime": { + "biblioteca.dll": {} + } + } + } + }, + "libraries": { + "biblioteca/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net9.0/biblioteca.dll b/bin/Debug/net9.0/biblioteca.dll new file mode 100644 index 0000000..9ad89a7 Binary files /dev/null and b/bin/Debug/net9.0/biblioteca.dll differ diff --git a/bin/Debug/net9.0/biblioteca.pdb b/bin/Debug/net9.0/biblioteca.pdb new file mode 100644 index 0000000..8e6f179 Binary files /dev/null and b/bin/Debug/net9.0/biblioteca.pdb differ diff --git a/bin/Debug/net9.0/biblioteca.runtimeconfig.json b/bin/Debug/net9.0/biblioteca.runtimeconfig.json new file mode 100644 index 0000000..b19c3c8 --- /dev/null +++ b/bin/Debug/net9.0/biblioteca.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/apphost b/obj/Debug/net9.0/apphost new file mode 100755 index 0000000..613549a Binary files /dev/null and b/obj/Debug/net9.0/apphost differ diff --git a/obj/Debug/net9.0/biblioteca.AssemblyInfo.cs b/obj/Debug/net9.0/biblioteca.AssemblyInfo.cs index dce2b3f..2f6121b 100644 --- a/obj/Debug/net9.0/biblioteca.AssemblyInfo.cs +++ b/obj/Debug/net9.0/biblioteca.AssemblyInfo.cs @@ -13,10 +13,10 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("biblioteca")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3a03e615888527814e42096963631995b875d7f7")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1e60a48eea80d0ccf5e6ca758d90fd2a0af06775")] [assembly: System.Reflection.AssemblyProductAttribute("biblioteca")] [assembly: System.Reflection.AssemblyTitleAttribute("biblioteca")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -// Generated by the MSBuild WriteCodeFragment class. +// Generato dalla classe WriteCodeFragment di MSBuild. diff --git a/obj/Debug/net9.0/biblioteca.AssemblyInfoInputs.cache b/obj/Debug/net9.0/biblioteca.AssemblyInfoInputs.cache index 87bdd41..409f319 100644 --- a/obj/Debug/net9.0/biblioteca.AssemblyInfoInputs.cache +++ b/obj/Debug/net9.0/biblioteca.AssemblyInfoInputs.cache @@ -1 +1 @@ -459e7955ba4252a3be22397cd3b5e71c5d58d11d307354d6993334cac373adf2 +b5871efc6e390aebc571734a0cd23a8997474bde51295597dd89db59d417a58f diff --git a/obj/Debug/net9.0/biblioteca.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/biblioteca.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..b9a011d --- /dev/null +++ b/obj/Debug/net9.0/biblioteca.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +a9f6fd306d1f84e9f310005b7ff2d4f04a3fd42213cb5e1e9be2cd058ed91c91 diff --git a/obj/Debug/net9.0/biblioteca.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/biblioteca.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..d972ee7 --- /dev/null +++ b/obj/Debug/net9.0/biblioteca.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +/home/Verde/git/biblioteca/bin/Debug/net9.0/biblioteca +/home/Verde/git/biblioteca/bin/Debug/net9.0/biblioteca.deps.json +/home/Verde/git/biblioteca/bin/Debug/net9.0/biblioteca.runtimeconfig.json +/home/Verde/git/biblioteca/bin/Debug/net9.0/biblioteca.dll +/home/Verde/git/biblioteca/bin/Debug/net9.0/biblioteca.pdb +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.GeneratedMSBuildEditorConfig.editorconfig +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.AssemblyInfoInputs.cache +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.AssemblyInfo.cs +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.csproj.CoreCompileInputs.cache +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.dll +/home/Verde/git/biblioteca/obj/Debug/net9.0/refint/biblioteca.dll +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.pdb +/home/Verde/git/biblioteca/obj/Debug/net9.0/biblioteca.genruntimeconfig.cache +/home/Verde/git/biblioteca/obj/Debug/net9.0/ref/biblioteca.dll diff --git a/obj/Debug/net9.0/biblioteca.dll b/obj/Debug/net9.0/biblioteca.dll new file mode 100644 index 0000000..9ad89a7 Binary files /dev/null and b/obj/Debug/net9.0/biblioteca.dll differ diff --git a/obj/Debug/net9.0/biblioteca.genruntimeconfig.cache b/obj/Debug/net9.0/biblioteca.genruntimeconfig.cache new file mode 100644 index 0000000..c01133c --- /dev/null +++ b/obj/Debug/net9.0/biblioteca.genruntimeconfig.cache @@ -0,0 +1 @@ +47110de21d993c562ae89b418c918d0fccbe3ce9a0fe954a85bed6ad0add4480 diff --git a/obj/Debug/net9.0/biblioteca.pdb b/obj/Debug/net9.0/biblioteca.pdb new file mode 100644 index 0000000..8e6f179 Binary files /dev/null and b/obj/Debug/net9.0/biblioteca.pdb differ diff --git a/obj/Debug/net9.0/ref/biblioteca.dll b/obj/Debug/net9.0/ref/biblioteca.dll new file mode 100644 index 0000000..4732923 Binary files /dev/null and b/obj/Debug/net9.0/ref/biblioteca.dll differ diff --git a/obj/Debug/net9.0/refint/biblioteca.dll b/obj/Debug/net9.0/refint/biblioteca.dll new file mode 100644 index 0000000..4732923 Binary files /dev/null and b/obj/Debug/net9.0/refint/biblioteca.dll differ