diff --git a/Program.cs b/Program.cs index 5999dc1..aeaf24b 100644 --- a/Program.cs +++ b/Program.cs @@ -4,6 +4,125 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + //dichiarazione e inizializzazione variabile + int scelta=9; + //Menù + Console.WriteLine("Scegliere un'operazione:"); + Console.WriteLine("1. Calcolo area e perimetro di un quadrato"); + Console.WriteLine("2. Calcolo sconto di un prezzo"); + Console.WriteLine("3. Calcolo media"); + Console.WriteLine("4. Calcolo età"); + Console.WriteLine("5. Calcolo rette perpendicolari"); + Console.WriteLine("0. Esci"); + Console.Write("Scelta: "); + scelta=Convert.ToInt32(Console.ReadLine()); + + + do{ + switch(scelta){ + case 0: + break; + case 1: + //dichiarazione e inizializzazione variabili + double lato, area, perimetro; + //ricevo input + Console.Write("Inserire il lato: "); + lato=Convert.ToDouble(Console.ReadLine()); + //chiamo funzioni per i calcoli + area=Area(lato); + perimetro=Perimetro(lato); + //output + Console.WriteLine("Il perimtetro è " +perimetro +" mentre l'area è " +area); + break; + case 2: + //dichiarazione e inizializzazione variabili + double prezzo, sconto; + //ricevo input + Console.Write("Inserire il prezzo: "); + prezzo=Convert.ToDouble(Console.ReadLine()); + Console.Write("Inserire la percentuale di sconto (senza %): "); + sconto=Convert.ToDouble(Console.ReadLine()); + //output con chiamata a funzione per il calcolo integrata + Console.WriteLine("Il prezzo scontato è " +Scontatore(prezzo, sconto)); + break; + case 3: + //dichiarazione e inizializzazione variabili + double somma, numeroVero; + string numero; + int i; + somma=0; + i=0; + //ricevo input di continuo + do{ + //ricevo input + Console.Write("Inserire un numero ([q] per terminare): "); + numero=Console.ReadLine(); + //verifico se non si vuole terminare + if(numero!="q"){ + numeroVero=Convert.ToDouble(numero);//non so come fare una condizione che verifichi se Convert.ToDouble abbia restituito un'eccezione aka è stata inserito un qualcosa che non sia un numero o q + somma=somma+numeroVero; + i++; + } + } + while(numero!="q"); + //output + Console.WriteLine("La media è " +Media(somma, i)); + break; + case 4: + int anno, nascita; + Console.Write("Che anno è? "); + anno=Convert.ToInt32(Console.ReadLine()); + Console.Write("Quando sei nato? "); + nascita=Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Hai " +Età(anno, nascita) +" anni"); + break; + case 5: + double coefficiente, intercetta; + Console.Write("Inserire il coefficiente angolare: "); + coefficiente=Convert.ToDouble(Console.ReadLine()); + Console.Write("Inserire l'intercetta: "); + intercetta=Convert.ToDouble(Console.ReadLine()); + if(IsPerpendicolare(coefficiente, intercetta)==true){ + Console.WriteLine("Le due rette sono perpendicolari"); + } + else{ + Console.WriteLine("Le due rette non sono perpendicolari"); + } + break; + default: + Console.WriteLine("Scelta non valida"); + break; + } + } + while(scelta!=0 && scelta!=1 && scelta!=2 && scelta!=3 && scelta!=4 && scelta!=5); + } + + static double Area(double p_lato){ + return p_lato*p_lato; + } + static double Perimetro(double p_lato){ + return p_lato*4; + } + + static double Scontatore(double p_prezzo, double p_sconto){ //Scontatore è da intendersi come "colui che applica lo sconto" (lo so che non è italiano ma mi stava simpatico come nome) + return p_prezzo-(p_prezzo*p_sconto/100); + } + + static double Media(double p_somma, int p_i){ + return p_somma/p_i; + } + + static int Età(int p_anno, int p_nascita){ + return p_anno-p_nascita; + } + + static bool IsPerpendicolare(double p_coefficiente, double p_intercetta){ + + if (p_coefficiente*p_intercetta==-1){ + return true; + } + else{ + return false; + } } } diff --git a/bin/Debug/net9.0/funzioni_2 b/bin/Debug/net9.0/funzioni_2 new file mode 100755 index 0000000..32c7b45 Binary files /dev/null and b/bin/Debug/net9.0/funzioni_2 differ diff --git a/bin/Debug/net9.0/funzioni_2.deps.json b/bin/Debug/net9.0/funzioni_2.deps.json new file mode 100644 index 0000000..7cd2efe --- /dev/null +++ b/bin/Debug/net9.0/funzioni_2.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v9.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v9.0": { + "funzioni_2/1.0.0": { + "runtime": { + "funzioni_2.dll": {} + } + } + } + }, + "libraries": { + "funzioni_2/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net9.0/funzioni_2.dll b/bin/Debug/net9.0/funzioni_2.dll new file mode 100644 index 0000000..e58e580 Binary files /dev/null and b/bin/Debug/net9.0/funzioni_2.dll differ diff --git a/bin/Debug/net9.0/funzioni_2.pdb b/bin/Debug/net9.0/funzioni_2.pdb new file mode 100644 index 0000000..bba5d5e Binary files /dev/null and b/bin/Debug/net9.0/funzioni_2.pdb differ diff --git a/bin/Debug/net9.0/funzioni_2.runtimeconfig.json b/bin/Debug/net9.0/funzioni_2.runtimeconfig.json new file mode 100644 index 0000000..b19c3c8 --- /dev/null +++ b/bin/Debug/net9.0/funzioni_2.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..32c7b45 Binary files /dev/null and b/obj/Debug/net9.0/apphost differ diff --git a/obj/Debug/net9.0/funzioni_2.AssemblyInfo.cs b/obj/Debug/net9.0/funzioni_2.AssemblyInfo.cs new file mode 100644 index 0000000..aad2328 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.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("funzioni_2")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5713e73e0f4bf87c7192ef8a76c71cab23ee0b71")] +[assembly: System.Reflection.AssemblyProductAttribute("funzioni_2")] +[assembly: System.Reflection.AssemblyTitleAttribute("funzioni_2")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generato dalla classe WriteCodeFragment di MSBuild. + diff --git a/obj/Debug/net9.0/funzioni_2.AssemblyInfoInputs.cache b/obj/Debug/net9.0/funzioni_2.AssemblyInfoInputs.cache new file mode 100644 index 0000000..6532611 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +6b63cadddfc682d63f46affe7872bb872920c20a5c76387da40259c0b6bd9482 diff --git a/obj/Debug/net9.0/funzioni_2.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/funzioni_2.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..e2182e2 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.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 = funzioni_2 +build_property.ProjectDir = /home/BrainTheBest5/git/funzioni_2/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/obj/Debug/net9.0/funzioni_2.GlobalUsings.g.cs b/obj/Debug/net9.0/funzioni_2.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.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/funzioni_2.assets.cache b/obj/Debug/net9.0/funzioni_2.assets.cache new file mode 100644 index 0000000..c569ddc Binary files /dev/null and b/obj/Debug/net9.0/funzioni_2.assets.cache differ diff --git a/obj/Debug/net9.0/funzioni_2.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/funzioni_2.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..198f952 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +8e3c979c6b7c07b6081ed1714b4b701ec12345eefac30d1d0672f7216f26f261 diff --git a/obj/Debug/net9.0/funzioni_2.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/funzioni_2.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..034df06 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +/home/BrainTheBest5/git/funzioni_2/bin/Debug/net9.0/funzioni_2 +/home/BrainTheBest5/git/funzioni_2/bin/Debug/net9.0/funzioni_2.deps.json +/home/BrainTheBest5/git/funzioni_2/bin/Debug/net9.0/funzioni_2.runtimeconfig.json +/home/BrainTheBest5/git/funzioni_2/bin/Debug/net9.0/funzioni_2.dll +/home/BrainTheBest5/git/funzioni_2/bin/Debug/net9.0/funzioni_2.pdb +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.GeneratedMSBuildEditorConfig.editorconfig +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.AssemblyInfoInputs.cache +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.AssemblyInfo.cs +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.csproj.CoreCompileInputs.cache +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.dll +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/refint/funzioni_2.dll +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.pdb +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/funzioni_2.genruntimeconfig.cache +/home/BrainTheBest5/git/funzioni_2/obj/Debug/net9.0/ref/funzioni_2.dll diff --git a/obj/Debug/net9.0/funzioni_2.dll b/obj/Debug/net9.0/funzioni_2.dll new file mode 100644 index 0000000..e58e580 Binary files /dev/null and b/obj/Debug/net9.0/funzioni_2.dll differ diff --git a/obj/Debug/net9.0/funzioni_2.genruntimeconfig.cache b/obj/Debug/net9.0/funzioni_2.genruntimeconfig.cache new file mode 100644 index 0000000..b399c14 --- /dev/null +++ b/obj/Debug/net9.0/funzioni_2.genruntimeconfig.cache @@ -0,0 +1 @@ +f624f9bd354842a7ee680a418e301e05b114da1ddb5fe33191943e19d3903a33 diff --git a/obj/Debug/net9.0/funzioni_2.pdb b/obj/Debug/net9.0/funzioni_2.pdb new file mode 100644 index 0000000..bba5d5e Binary files /dev/null and b/obj/Debug/net9.0/funzioni_2.pdb differ diff --git a/obj/Debug/net9.0/ref/funzioni_2.dll b/obj/Debug/net9.0/ref/funzioni_2.dll new file mode 100644 index 0000000..1ab18b5 Binary files /dev/null and b/obj/Debug/net9.0/ref/funzioni_2.dll differ diff --git a/obj/Debug/net9.0/refint/funzioni_2.dll b/obj/Debug/net9.0/refint/funzioni_2.dll new file mode 100644 index 0000000..1ab18b5 Binary files /dev/null and b/obj/Debug/net9.0/refint/funzioni_2.dll differ