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

Trabalho concluido #137

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
14 changes: 11 additions & 3 deletions Models/Iphone.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
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($"O celular está instalando o aplicativo {nomeApp} pela appleStore, loja exclusiva do IPhone");
}
}
}
14 changes: 11 additions & 3 deletions Models/Nokia.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
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($"O celular está instalando o aplicativo {nomeApp} pela google playstore, loja presente em todos os dispositivos Androids");
}
}
}
29 changes: 24 additions & 5 deletions Models/Smartphone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ namespace DesafioPOO.Models
{
public abstract class Smartphone
{
public string Numero { get; set; }
// TODO: Implementar as propriedades faltantes de acordo com o diagrama
public string numero
{
get; set;
}

private string _modelo
{
get; set;
}

private string _IMEI
{
get; set;
}

private int _memoria
{
get; set;
}

public Smartphone(string numero)
public Smartphone(string Numero, string Modelo, string IMEI, int Memoria)
{
Numero = numero;
// TODO: Passar os parâmetros do construtor para as propriedades
numero = Numero;
_modelo = Modelo;
_IMEI = IMEI;
_memoria = Memoria;
}

public void Ligar()
Expand Down
16 changes: 15 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
using DesafioPOO.Models;

// TODO: Realizar os testes com as classes Nokia e Iphone
Iphone celular = new Iphone("(00)1234-5678", "Ïphone 13 plus", "001", 32);
Console.WriteLine(celular.numero);
celular.Ligar();
celular.ReceberLigacao();
celular.numero = "(11)5678-1234";
Console.WriteLine(celular.numero);
celular.InstalarAplicativo("Whatsapp");

Nokia celular2 = new Nokia("(00)1234-5678", "Nokia open camera", "002", 16);
Console.WriteLine(celular2.numero);
celular2.Ligar();
celular2.ReceberLigacao();
celular2.numero = "(11)5678-1234";
Console.WriteLine(celular.numero);
celular2.InstalarAplicativo("Telegram");