Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _______________________________________________________________________________________
- CLASE MASCOTA
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Proyecto_Animales
- {
- class Mascota
- {
- private string nombre;
- private int edad;
- private int tipo;
- private Dueño dueño;
- public int pEdad { get { return edad; } set { edad = value; } }
- public int pTipo { get { return tipo; } set { tipo = value; } }
- public string pNombre { get { return nombre; } set { nombre = value; } }
- public Dueño pDueño { get { return dueño; } set { dueño = value; } }
- public Mascota()
- {
- nombre = "";
- edad = 0;
- tipo = 0;
- dueño = null;
- }
- public Mascota(string nombre, int edad, int tipo, Dueño dueño)
- {
- this.nombre = nombre;
- this.edad = edad;
- this.tipo = tipo;
- this.dueño = dueño;
- }
- public string toStringtipo()
- {
- switch(tipo){
- case 1: return "Perro";
- case 2: return "Gato";
- case 3: return "Ave";
- case 4: return "Roedor";
- default: return "Pickea tipo";
- }
- }
- public string toStringMascota()
- {
- return "Datos Mascota: " + "\n" + "\n"
- + "Nombre: " + nombre + "\n"
- + "Edad: " + edad + "\n"
- + "Tipo: " + toStringtipo() + "\n"
- + "\n" + "\n"
- + "Datos Dueño: " + "\n" + "\n"
- + dueño.toStringDueño();
- }
- }
- }
- ____________________________________________________________________________________________
- CLASE DUEÑO
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Proyecto_Animales
- {
- class Dueño
- {
- private int codigo;
- private string nombre;
- private bool sexo;
- public int pCodigo { get { return codigo; } set { codigo = value; } }
- public string pNombre { get { return nombre; } set { nombre = value; } }
- public bool pSexo { get { return sexo; } set { sexo = value; } }
- public Dueño()
- {
- codigo = 0;
- nombre = "";
- sexo = true;
- }
- public Dueño(int codigo, string nombre, bool sexo)
- {
- this.codigo = codigo;
- this.nombre = nombre;
- this.sexo = sexo;
- }
- public string toStringSexo()
- {
- if (sexo)
- return "Masculino";
- else
- return "Femenino";
- }
- public string toStringDueño()
- {
- return "Código: " + codigo + "\n"
- + "Nombre: " + nombre + "\n"
- + "Sexo: " + toStringSexo() + "\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement