diff --git a/Models/Iphone.cs b/Models/Iphone.cs index 88213bf7d..4ed01e5c1 100644 --- a/Models/Iphone.cs +++ b/Models/Iphone.cs @@ -1,8 +1,18 @@ namespace DesafioPOO.Models { + public class Iphone : Smartphone + { + public Iphone(string numero, string modelo, string imei, int memoria) : base(numero, modelo, imei, memoria) + { + + } + // TODO: Herdar da classe "Smartphone" - public class Iphone + public override void InstalarAplicativo(string nome) { + Console.WriteLine($"Instalando {nome} no Iphone."); // TODO: Sobrescrever o método "InstalarAplicativo" } +} + } \ No newline at end of file diff --git a/Models/Nokia.cs b/Models/Nokia.cs index 5636bdb6a..91cf6afe5 100644 --- a/Models/Nokia.cs +++ b/Models/Nokia.cs @@ -1,8 +1,19 @@ +using System.ComponentModel; +using System.Security.Cryptography.X509Certificates; namespace DesafioPOO.Models +{ + + +public class Nokia : Smartphone { // TODO: Herdar da classe "Smartphone" - public class Nokia + public Nokia(string numero, string modelo, string imei, int memoria) : base(numero, modelo, imei, memoria) { + } + public override void InstalarAplicativo(string nome) + { + Console.WriteLine($"Instalando {nome} no Nokia."); + } // TODO: Sobrescrever o método "InstalarAplicativo" } } \ No newline at end of file diff --git a/Models/Smartphone.cs b/Models/Smartphone.cs index 12ea67437..af1b70821 100644 --- a/Models/Smartphone.cs +++ b/Models/Smartphone.cs @@ -1,13 +1,21 @@ +using System.Dynamic; + namespace DesafioPOO.Models { public abstract class Smartphone { public string Numero { get; set; } + private string Modelo { get; set;} + private string IMEI {get; set;} + private int Memoria {get; set;} // TODO: Implementar as propriedades faltantes de acordo com o diagrama - public Smartphone(string numero) + public Smartphone(string numero, string modelo, string imei, int memoria) { Numero = numero; + Modelo = modelo; + IMEI = imei; + Memoria = memoria; // TODO: Passar os parâmetros do construtor para as propriedades } diff --git a/Program.cs b/Program.cs index 34e01093d..a2c131488 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,20 @@ using DesafioPOO.Models; +public class Program +{ + public static void Main(string[] args) + { + // Criando um objeto do tipo Nokia + Nokia nokia = new Nokia("123456789", "Nokia 3310", "123456789IMEI", 64); + nokia.Ligar(); + nokia.ReceberLigacao(); + nokia.InstalarAplicativo("WhatsApp"); + + // Criando um objeto do tipo Iphone + Iphone iphone = new Iphone("987654321", "iPhone X", "987654321IMEI", 128); + iphone.Ligar(); + iphone.ReceberLigacao(); + iphone.InstalarAplicativo("Instagram"); + } +} // TODO: Realizar os testes com as classes Nokia e Iphone \ No newline at end of file diff --git a/trilha-net-poo-desafio.sln b/trilha-net-poo-desafio.sln new file mode 100644 index 000000000..3e482e7d0 --- /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", "{78FB3313-EDD8-424A-ACC9-18815D78749D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78FB3313-EDD8-424A-ACC9-18815D78749D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78FB3313-EDD8-424A-ACC9-18815D78749D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78FB3313-EDD8-424A-ACC9-18815D78749D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78FB3313-EDD8-424A-ACC9-18815D78749D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C3090D4C-6C20-427A-B542-D09C14421325} + EndGlobalSection +EndGlobal