diff --git a/DesafioPOO.csproj b/DesafioPOO.csproj index 5eb1e8455..c1368a7f9 100644 --- a/DesafioPOO.csproj +++ b/DesafioPOO.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable disable diff --git a/Models/Iphone.cs b/Models/Iphone.cs index 88213bf7d..43b47c6a9 100644 --- a/Models/Iphone.cs +++ b/Models/Iphone.cs @@ -1,8 +1,15 @@ namespace DesafioPOO.Models { - // TODO: Herdar da classe "Smartphone" - public class Iphone + public class Iphone : Smartphone { - // TODO: Sobrescrever o método "InstalarAplicativo" + public Iphone(string numero, string modelo, string imei, int memoria) : base(numero, modelo, imei, memoria) + { + + } + + public override void InstalarAplicativo(string nomeApp) + { + Console.WriteLine($"Instalando o aplicativo {nomeApp} no Iphone"); + } } } \ No newline at end of file diff --git a/Models/Nokia.cs b/Models/Nokia.cs index 5636bdb6a..7b8328e8f 100644 --- a/Models/Nokia.cs +++ b/Models/Nokia.cs @@ -1,8 +1,14 @@ namespace DesafioPOO.Models { - // TODO: Herdar da classe "Smartphone" - public class Nokia + public class Nokia : Smartphone { - // TODO: Sobrescrever o método "InstalarAplicativo" + public Nokia(string numero, string modelo, string imei, int memoria) : base(numero, modelo, imei, memoria) + { + + } + public override void InstalarAplicativo(string nomeApp) + { + Console.WriteLine($"Instalando o aplicativo {nomeApp} no Nokia"); + } } } \ No newline at end of file diff --git a/Models/Smartphone.cs b/Models/Smartphone.cs index 12ea67437..cfda318fb 100644 --- a/Models/Smartphone.cs +++ b/Models/Smartphone.cs @@ -3,13 +3,21 @@ namespace DesafioPOO.Models public abstract class Smartphone { public string Numero { get; set; } - // TODO: Implementar as propriedades faltantes de acordo com o diagrama - public Smartphone(string numero) + private string Modelo; + + private string IMEI; + + public int Memoria { get; set; } + + public Smartphone(string numero, string modelo, string imei, int memoria) { Numero = numero; - // TODO: Passar os parâmetros do construtor para as propriedades - } + Modelo = modelo; + IMEI = imei; + Memoria = memoria; + + } public void Ligar() { diff --git a/Program.cs b/Program.cs index 34e01093d..80c7e723b 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,16 @@ -using DesafioPOO.Models; +using System.Net; +using DesafioPOO.Models; -// TODO: Realizar os testes com as classes Nokia e Iphone \ No newline at end of file +Console.WriteLine("Teste Nokia:"); +Smartphone nokia = new Nokia(numero: "11111111111", modelo: "Modelo X", imei: "102030", memoria: 512); +nokia.Ligar(); +nokia.InstalarAplicativo("Pokemon GO"); +nokia.ReceberLigacao(); + +Console.WriteLine("\n"); + +Console.WriteLine("Teste Iphone:"); +Smartphone iphone = new Iphone(numero: "11222222222", modelo: "Modelo Y", imei: "304050", memoria: 64); +nokia.Ligar(); +nokia.InstalarAplicativo("Github"); +nokia.ReceberLigacao(); diff --git a/trilha-net-poo-desafio.sln b/trilha-net-poo-desafio.sln new file mode 100644 index 000000000..01dde707b --- /dev/null +++ b/trilha-net-poo-desafio.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesafioPOO", "DesafioPOO.csproj", "{1EA082E5-CF7C-4543-A476-428E0CFF3AC5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1EA082E5-CF7C-4543-A476-428E0CFF3AC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EA082E5-CF7C-4543-A476-428E0CFF3AC5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EA082E5-CF7C-4543-A476-428E0CFF3AC5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EA082E5-CF7C-4543-A476-428E0CFF3AC5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EF8CA6EC-B4BD-4AD0-9BD7-BE5CC21570C5} + EndGlobalSection +EndGlobal