Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolução desafio POO #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DesafioPOO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
13 changes: 10 additions & 3 deletions Models/Iphone.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
12 changes: 9 additions & 3 deletions Models/Nokia.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
16 changes: 12 additions & 4 deletions Models/Smartphone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
17 changes: 15 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
using DesafioPOO.Models;
using System.Net;
using DesafioPOO.Models;

// TODO: Realizar os testes com as classes Nokia e Iphone
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();
25 changes: 25 additions & 0 deletions trilha-net-poo-desafio.sln
Original file line number Diff line number Diff line change
@@ -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