Sembra tutto ok
This commit is contained in:
parent
ab7b142627
commit
7220121719
118
Program.cs
118
Program.cs
@ -4,6 +4,122 @@ 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:
|
||||
Areaperimetro();
|
||||
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 void Areaperimetro(){
|
||||
//dichiarazione e inizializzazione variabili
|
||||
double lato, area, perimetro;
|
||||
//ricevo dati
|
||||
Console.Write("Inserire il lato: ");
|
||||
lato=Convert.ToDouble(Console.ReadLine());
|
||||
//calcoli
|
||||
perimetro=lato*4;
|
||||
area=lato*lato;
|
||||
//output
|
||||
Console.WriteLine("Il perimtetro è " +perimetro +" mentre l'area è " +area);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
bin/Debug/net9.0/funzioni_1
Executable file
BIN
bin/Debug/net9.0/funzioni_1
Executable file
Binary file not shown.
23
bin/Debug/net9.0/funzioni_1.deps.json
Normal file
23
bin/Debug/net9.0/funzioni_1.deps.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v9.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v9.0": {
|
||||
"funzioni_1/1.0.0": {
|
||||
"runtime": {
|
||||
"funzioni_1.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"funzioni_1/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
bin/Debug/net9.0/funzioni_1.dll
Normal file
BIN
bin/Debug/net9.0/funzioni_1.dll
Normal file
Binary file not shown.
BIN
bin/Debug/net9.0/funzioni_1.pdb
Normal file
BIN
bin/Debug/net9.0/funzioni_1.pdb
Normal file
Binary file not shown.
12
bin/Debug/net9.0/funzioni_1.runtimeconfig.json
Normal file
12
bin/Debug/net9.0/funzioni_1.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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||
BIN
obj/Debug/net9.0/apphost
Executable file
BIN
obj/Debug/net9.0/apphost
Executable file
Binary file not shown.
22
obj/Debug/net9.0/funzioni_1.AssemblyInfo.cs
Normal file
22
obj/Debug/net9.0/funzioni_1.AssemblyInfo.cs
Normal file
@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("funzioni_1")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ab7b142627bf41c67d6df8af1d79c03d3b2b2c55")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("funzioni_1")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("funzioni_1")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||
|
||||
1
obj/Debug/net9.0/funzioni_1.AssemblyInfoInputs.cache
Normal file
1
obj/Debug/net9.0/funzioni_1.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
||||
8032a027450a4e6df43e7e58e630f9b2204d8460345b178fd62e205bb4114bd3
|
||||
@ -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_1
|
||||
build_property.ProjectDir = /home/BrainTheBest5/git/funzioni_1/
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
8
obj/Debug/net9.0/funzioni_1.GlobalUsings.g.cs
Normal file
8
obj/Debug/net9.0/funzioni_1.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
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;
|
||||
BIN
obj/Debug/net9.0/funzioni_1.assets.cache
Normal file
BIN
obj/Debug/net9.0/funzioni_1.assets.cache
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
dfecd8f4f0897cdfe4f0fc24d0f97b9aedbb04c4b8403213951aaa30a3292dec
|
||||
14
obj/Debug/net9.0/funzioni_1.csproj.FileListAbsolute.txt
Normal file
14
obj/Debug/net9.0/funzioni_1.csproj.FileListAbsolute.txt
Normal file
@ -0,0 +1,14 @@
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.GeneratedMSBuildEditorConfig.editorconfig
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.AssemblyInfoInputs.cache
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.AssemblyInfo.cs
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.csproj.CoreCompileInputs.cache
|
||||
/home/BrainTheBest5/git/funzioni_1/bin/Debug/net9.0/funzioni_1
|
||||
/home/BrainTheBest5/git/funzioni_1/bin/Debug/net9.0/funzioni_1.deps.json
|
||||
/home/BrainTheBest5/git/funzioni_1/bin/Debug/net9.0/funzioni_1.runtimeconfig.json
|
||||
/home/BrainTheBest5/git/funzioni_1/bin/Debug/net9.0/funzioni_1.dll
|
||||
/home/BrainTheBest5/git/funzioni_1/bin/Debug/net9.0/funzioni_1.pdb
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.dll
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/refint/funzioni_1.dll
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.pdb
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/funzioni_1.genruntimeconfig.cache
|
||||
/home/BrainTheBest5/git/funzioni_1/obj/Debug/net9.0/ref/funzioni_1.dll
|
||||
BIN
obj/Debug/net9.0/funzioni_1.dll
Normal file
BIN
obj/Debug/net9.0/funzioni_1.dll
Normal file
Binary file not shown.
1
obj/Debug/net9.0/funzioni_1.genruntimeconfig.cache
Normal file
1
obj/Debug/net9.0/funzioni_1.genruntimeconfig.cache
Normal file
@ -0,0 +1 @@
|
||||
6a6e1a4e25ffb62c28ad5f7edb16e2a8bde2d2f23fc9bca882bfc7a1cad5ef4e
|
||||
BIN
obj/Debug/net9.0/funzioni_1.pdb
Normal file
BIN
obj/Debug/net9.0/funzioni_1.pdb
Normal file
Binary file not shown.
BIN
obj/Debug/net9.0/ref/funzioni_1.dll
Normal file
BIN
obj/Debug/net9.0/ref/funzioni_1.dll
Normal file
Binary file not shown.
BIN
obj/Debug/net9.0/refint/funzioni_1.dll
Normal file
BIN
obj/Debug/net9.0/refint/funzioni_1.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user