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

Desafio concluido #110

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
11 changes: 10 additions & 1 deletion Models/Iphone.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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: Sobrescrever o método "InstalarAplicativo"
public override void InstalarAplicativo(string nomeApp)
{
System.Console.WriteLine($"Instalando o aplicativo {nomeApp} no iPhone {Modelo}");
}
}
}
11 changes: 10 additions & 1 deletion Models/Nokia.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
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)
{
System.Console.WriteLine($"Instalando o aplicativo {nomeApp} no Nokia {Modelo}");
}
}
}
8 changes: 7 additions & 1 deletion Models/Smartphone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ public abstract class Smartphone
{
public string Numero { get; set; }
// TODO: Implementar as propriedades faltantes de acordo com o diagrama
protected string Modelo;
protected string Imei;
protected int Memoria;

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
}

Expand Down
14 changes: 13 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
using DesafioPOO.Models;

// TODO: Realizar os testes com as classes Nokia e Iphone
Smartphone nokia = new Nokia(numero: "123456789", modelo: "3310", imei: "123456789", memoria: 16);
Smartphone iphone = new Iphone(numero: "987654321", modelo: "12", imei: "987654321", memoria: 128);

System.Console.WriteLine("Nokia:");
nokia.Ligar();
nokia.ReceberLigacao();
nokia.InstalarAplicativo("Snake");

System.Console.WriteLine("\nIphone:");
iphone.Ligar();
iphone.ReceberLigacao();
iphone.InstalarAplicativo("Instagram");

25 changes: 25 additions & 0 deletions trilha-net-poo-desafio.generated.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", "{619EA49A-E69E-4D54-878A-99DEA45BBC63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{619EA49A-E69E-4D54-878A-99DEA45BBC63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{619EA49A-E69E-4D54-878A-99DEA45BBC63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{619EA49A-E69E-4D54-878A-99DEA45BBC63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{619EA49A-E69E-4D54-878A-99DEA45BBC63}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5BB3C088-2B1F-4EDC-97F9-0061508C9C4D}
EndGlobalSection
EndGlobal