Fixes
This commit is contained in:
parent
1e60a48eea
commit
93e3321eed
31
Program.cs
31
Program.cs
@ -3,8 +3,8 @@
|
|||||||
class Program {
|
class Program {
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
const int MAX_LIBRI = 10;
|
const int MAX_LIBRI = 2;
|
||||||
int scelta, j;
|
int scelta, libroSelezionato = -1;
|
||||||
Libro[] biblioteca = new Libro[MAX_LIBRI];
|
Libro[] biblioteca = new Libro[MAX_LIBRI];
|
||||||
bool oggettoEsistente, nomeEsistente, casaEditriceEsistente;
|
bool oggettoEsistente, nomeEsistente, casaEditriceEsistente;
|
||||||
string casaEditrice, nome;
|
string casaEditrice, nome;
|
||||||
@ -15,6 +15,7 @@ class Program {
|
|||||||
Console.WriteLine("2. Mostra biblioteca");
|
Console.WriteLine("2. Mostra biblioteca");
|
||||||
Console.WriteLine("3. Mostra libro");
|
Console.WriteLine("3. Mostra libro");
|
||||||
Console.WriteLine("4. Applica sconto");
|
Console.WriteLine("4. Applica sconto");
|
||||||
|
Console.WriteLine("5. Pulisci schermo");
|
||||||
Console.WriteLine("0. Esci");
|
Console.WriteLine("0. Esci");
|
||||||
Console.Write("Scelta: ");
|
Console.Write("Scelta: ");
|
||||||
scelta = Convert.ToInt32(Console.ReadLine());
|
scelta = Convert.ToInt32(Console.ReadLine());
|
||||||
@ -70,6 +71,7 @@ class Program {
|
|||||||
}
|
}
|
||||||
while (scelta < 0 || scelta > biblioteca.Length);
|
while (scelta < 0 || scelta > biblioteca.Length);
|
||||||
biblioteca[scelta].StampaLibro();
|
biblioteca[scelta].StampaLibro();
|
||||||
|
scelta = int.MaxValue;
|
||||||
}
|
}
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
@ -86,16 +88,14 @@ class Program {
|
|||||||
else {
|
else {
|
||||||
Console.WriteLine("Scegliere un nome:");
|
Console.WriteLine("Scegliere un nome:");
|
||||||
for (int i = 0; i < biblioteca.Length; i++) {
|
for (int i = 0; i < biblioteca.Length; i++) {
|
||||||
biblioteca[i].GetNome();
|
Console.WriteLine($"{biblioteca[i].GetNome()}");
|
||||||
Console.WriteLine();
|
|
||||||
}
|
}
|
||||||
Console.Write("Nome: ");
|
Console.Write("Nome: ");
|
||||||
nome = Console.ReadLine();
|
nome = Console.ReadLine();
|
||||||
|
|
||||||
Console.WriteLine("Scegliere una casa editrice:");
|
Console.WriteLine("Scegliere una casa editrice:");
|
||||||
for (int i = 0; i < biblioteca.Length; i++) {
|
for (int i = 0; i < biblioteca.Length; i++) {
|
||||||
biblioteca[i].GetCasaEditrice();
|
Console.WriteLine($"{biblioteca[i].GetCasaEditrice()}");
|
||||||
Console.WriteLine();
|
|
||||||
}
|
}
|
||||||
Console.Write("Casa editrice: ");
|
Console.Write("Casa editrice: ");
|
||||||
casaEditrice = Console.ReadLine();
|
casaEditrice = Console.ReadLine();
|
||||||
@ -103,21 +103,24 @@ class Program {
|
|||||||
nomeEsistente = false;
|
nomeEsistente = false;
|
||||||
casaEditriceEsistente = false;
|
casaEditriceEsistente = false;
|
||||||
|
|
||||||
for (j = 0; j < biblioteca.Length && !nomeEsistente && !casaEditriceEsistente; j++) {
|
for (int i = 0; i < biblioteca.Length && !nomeEsistente && !casaEditriceEsistente; i++) {
|
||||||
nomeEsistente = biblioteca[j].GetNome() == nome;
|
nomeEsistente = biblioteca[i].GetNome() == nome;
|
||||||
casaEditriceEsistente = biblioteca[j].GetCasaEditrice() == casaEditrice;
|
casaEditriceEsistente = biblioteca[i].GetCasaEditrice() == casaEditrice;
|
||||||
|
libroSelezionato = i;
|
||||||
}
|
}
|
||||||
if (!nomeEsistente || !casaEditriceEsistente) {
|
if (!nomeEsistente || !casaEditriceEsistente) {
|
||||||
Console.WriteLine($"Nessun libro di nome {nome} di casa editrice {casaEditrice} esistente.");
|
Console.WriteLine($"Nessun libro di nome {nome} di casa editrice {casaEditrice} esistente.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
biblioteca[j].ApplicaSconto();
|
biblioteca[libroSelezionato].ApplicaSconto();
|
||||||
|
Console.WriteLine("Sconto applicato.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
Console.Clear();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Console.WriteLine("Opzione non valida.");
|
Console.WriteLine("Opzione non valida.");
|
||||||
Pausa();
|
Pausa();
|
||||||
@ -146,7 +149,7 @@ class Program {
|
|||||||
nome = Console.ReadLine();
|
nome = Console.ReadLine();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Console.Write("Inserire il prezzo del libro:");
|
Console.Write("Inserire il prezzo del libro: ");
|
||||||
prezzo = Convert.ToDouble(Console.ReadLine());
|
prezzo = Convert.ToDouble(Console.ReadLine());
|
||||||
if (prezzo <= 0) {
|
if (prezzo <= 0) {
|
||||||
Console.WriteLine("Errore: il prezzo non può essere minore o uguale a zero.");
|
Console.WriteLine("Errore: il prezzo non può essere minore o uguale a zero.");
|
||||||
@ -156,7 +159,7 @@ class Program {
|
|||||||
while (prezzo <= 0);
|
while (prezzo <= 0);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Console.Write("Inserire il numero di pagine del libro:");
|
Console.Write("Inserire il numero di pagine del libro: ");
|
||||||
numeroPagine = Convert.ToInt32(Console.ReadLine());
|
numeroPagine = Convert.ToInt32(Console.ReadLine());
|
||||||
if (numeroPagine <= 0) {
|
if (numeroPagine <= 0) {
|
||||||
Console.WriteLine("Errore: il numero di pagine non può essere minore o uguale a zero.");
|
Console.WriteLine("Errore: il numero di pagine non può essere minore o uguale a zero.");
|
||||||
|
|||||||
BIN
bin/Debug/net9.0/biblioteca
Executable file
BIN
bin/Debug/net9.0/biblioteca
Executable file
Binary file not shown.
23
bin/Debug/net9.0/biblioteca.deps.json
Normal file
23
bin/Debug/net9.0/biblioteca.deps.json
Normal file
@ -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": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
bin/Debug/net9.0/biblioteca.dll
Normal file
BIN
bin/Debug/net9.0/biblioteca.dll
Normal file
Binary file not shown.
BIN
bin/Debug/net9.0/biblioteca.pdb
Normal file
BIN
bin/Debug/net9.0/biblioteca.pdb
Normal file
Binary file not shown.
12
bin/Debug/net9.0/biblioteca.runtimeconfig.json
Normal file
12
bin/Debug/net9.0/biblioteca.runtimeconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net9.0",
|
||||||
|
"framework": {
|
||||||
|
"name": "Microsoft.NETCore.App",
|
||||||
|
"version": "9.0.0"
|
||||||
|
},
|
||||||
|
"configProperties": {
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
obj/Debug/net9.0/apphost
Executable file
BIN
obj/Debug/net9.0/apphost
Executable file
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("biblioteca")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("biblioteca")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("biblioteca")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("biblioteca")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("biblioteca")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
459e7955ba4252a3be22397cd3b5e71c5d58d11d307354d6993334cac373adf2
|
b5871efc6e390aebc571734a0cd23a8997474bde51295597dd89db59d417a58f
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
a9f6fd306d1f84e9f310005b7ff2d4f04a3fd42213cb5e1e9be2cd058ed91c91
|
||||||
14
obj/Debug/net9.0/biblioteca.csproj.FileListAbsolute.txt
Normal file
14
obj/Debug/net9.0/biblioteca.csproj.FileListAbsolute.txt
Normal file
@ -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
|
||||||
BIN
obj/Debug/net9.0/biblioteca.dll
Normal file
BIN
obj/Debug/net9.0/biblioteca.dll
Normal file
Binary file not shown.
1
obj/Debug/net9.0/biblioteca.genruntimeconfig.cache
Normal file
1
obj/Debug/net9.0/biblioteca.genruntimeconfig.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
47110de21d993c562ae89b418c918d0fccbe3ce9a0fe954a85bed6ad0add4480
|
||||||
BIN
obj/Debug/net9.0/biblioteca.pdb
Normal file
BIN
obj/Debug/net9.0/biblioteca.pdb
Normal file
Binary file not shown.
BIN
obj/Debug/net9.0/ref/biblioteca.dll
Normal file
BIN
obj/Debug/net9.0/ref/biblioteca.dll
Normal file
Binary file not shown.
BIN
obj/Debug/net9.0/refint/biblioteca.dll
Normal file
BIN
obj/Debug/net9.0/refint/biblioteca.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user