Created
July 17, 2014 00:52
-
-
Save Fhernd/68a180f37ebabc6f7699 to your computer and use it in GitHub Desktop.
Implementación de la clase Juego.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: Juego.cs | |
// | |
// Original en: http://goo.gl/YZ3QEF | |
// | |
// Propósito: Representar la entidad Juego. | |
// | |
============================================================*/ | |
using System; | |
namespace JuegosCelulares.Modelo | |
{ | |
/// <summary> | |
/// Representa un videojuego. | |
/// </summary> | |
public class Juego | |
{ | |
#region Campos | |
/// <summary> | |
/// Cantidad actual del videojuego en bodega. | |
/// </summary> | |
private int cantidadActual; | |
/// <summary> | |
/// Categoría del videojuego (Acción, Aventura, Velocidad, Deporte) | |
/// </summary> | |
private CategoriaJuego categoria; | |
/// <summary> | |
/// Nombre del videojuego. | |
/// </summary> | |
private string nombre; | |
/// <summary> | |
/// Precio del videojuego. | |
/// </summary> | |
private decimal precio; | |
/// <summary> | |
/// Tamaño en KB que ocupa el videojuego. | |
/// </summary> | |
private int tamanioKB; | |
#endregion | |
#region Propiedades | |
/// <summary> | |
/// Recupera y modifica la cantidad actual del videojuego en bodega. | |
/// </summary> | |
public int CantidadActual | |
{ | |
get | |
{ | |
return cantidadActual; | |
} | |
set | |
{ | |
cantidadActual = value; | |
} | |
} | |
/// <summary> | |
/// Recupera y modifica la categoría del videojuego. | |
/// </summary> | |
public CategoriaJuego Categoria | |
{ | |
get | |
{ | |
return categoria; | |
} | |
set | |
{ | |
categoria = value; | |
} | |
} | |
/// <summary> | |
/// Recupera y modifica el nombre del videojuego. | |
/// </summary> | |
public string Nombre | |
{ | |
get | |
{ | |
return nombre; | |
} | |
set | |
{ | |
nombre = value; | |
} | |
} | |
/// <summary> | |
/// Recupera y modifica el precio del videojuego. | |
/// </summary> | |
public decimal Precio | |
{ | |
get | |
{ | |
return precio; | |
} | |
set | |
{ | |
precio = value; | |
} | |
} | |
/// <summary> | |
/// Recupera y modifica el tamaño en KB del videojuego. | |
/// </summary> | |
public int TamanioKB | |
{ | |
get | |
{ | |
return tamanioKB; | |
} | |
set | |
{ | |
tamanioKB = value; | |
} | |
} | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Crea una instancia de Juego. | |
/// </summary> | |
/// <param name="nombre">Nombre del videojuego.</param> | |
/// <param name="categoria">Catego</param> | |
/// <param name="precio">Categoría del videojuego (Acción, Aventura, Velocidad, Deporte)</param> | |
/// <param name="tamanioKB">Tamaño en KB del videojuego.</param> | |
/// <param name="cantidad">Cantidad de unidades del videojuego en bodega.</param> | |
public Juego(string nombre, CategoriaJuego categoria, decimal precio, int tamanioKB, int cantidad) | |
{ | |
this.nombre = nombre; | |
this.categoria = categoria; | |
this.precio = precio; | |
this.tamanioKB = tamanioKB; | |
this.cantidadActual = cantidad; | |
} | |
#endregion | |
#region Métodos | |
/// <summary> | |
/// Compra un juego y dispone las unidades en la bodega. | |
/// </summary> | |
/// <param name="cantidad">Cantidad de unidades a comprar.</param> | |
public void ComprarJuego(int cantidad) | |
{ | |
cantidadActual += cantidad; | |
} | |
/// <summary> | |
/// Vende un juego y extrae las unidades desde la bodega. | |
/// </summary> | |
/// <param name="cantidad">Cantidad de unidades a vender.</param> | |
public void VenderJuego(int cantidad) | |
{ | |
cantidadActual -= cantidad; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment