diff --git a/.gitignore b/.gitignore index 8a30d258e..5fbe55bcd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ ## ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +*.sln # User-specific files *.rsuser *.suo 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..eaaf02641 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 { + public Iphone(string numero, string modelo, string imei,int memoria): base(numero,modelo,imei,memoria) + { + // TODO: Passar os parâmetros do construtor para as propriedades + } // TODO: Sobrescrever o método "InstalarAplicativo" + public override void InstalarAplicativo(string nomeApp){ + Console.WriteLine($"{nomeApp} instalado no Iphone"); + } } } \ No newline at end of file diff --git a/Models/Nokia.cs b/Models/Nokia.cs index 5636bdb6a..5a1c58af0 100644 --- a/Models/Nokia.cs +++ b/Models/Nokia.cs @@ -1,8 +1,15 @@ namespace DesafioPOO.Models { // TODO: Herdar da classe "Smartphone" - public class Nokia + public class Nokia: Smartphone { + public Nokia(string numero, string modelo, string imei,int memoria): base(numero,modelo,imei,memoria) + { + + } // TODO: Sobrescrever o método "InstalarAplicativo" + public override void InstalarAplicativo(string nomeApp){ + Console.WriteLine($"{nomeApp} instalado no Nokia"); + } } } \ No newline at end of file diff --git a/Models/Smartphone.cs b/Models/Smartphone.cs index 12ea67437..704fa50d0 100644 --- a/Models/Smartphone.cs +++ b/Models/Smartphone.cs @@ -4,10 +4,16 @@ 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; + private int Memoria; + + 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..02e2d9e97 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,16 @@ using DesafioPOO.Models; -// TODO: Realizar os testes com as classes Nokia e Iphone \ No newline at end of file +// TODO: Realizar os testes com as classes Nokia e Iphone + +Smartphone nokia=new Nokia("123","1","2",4); + +Smartphone iphone=new Iphone("321","412323","34545",4); + +nokia.InstalarAplicativo("Whatsapp"); +nokia.Ligar(); +nokia.ReceberLigacao(); + + +iphone.InstalarAplicativo("Whatsapp"); +iphone.Ligar(); +iphone.ReceberLigacao(); \ 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..84b558b44 --- /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", "{E4C4E06B-D99D-41E3-8D2C-0FD412668CFF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E4C4E06B-D99D-41E3-8D2C-0FD412668CFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4C4E06B-D99D-41E3-8D2C-0FD412668CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4C4E06B-D99D-41E3-8D2C-0FD412668CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4C4E06B-D99D-41E3-8D2C-0FD412668CFF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8F8D012F-D8FD-4E3C-846C-FA4CD3793144} + EndGlobalSection +EndGlobal