Programación Orientada a Objetos (Tower defense - kingdom rush)
Moderator: julianmartinez16
-
atv234
- Posts: 78
- Joined: Tue Jan 19, 2016 12:05 pm
Post
by atv234 » Thu Aug 30, 2018 7:37 am
Code: Select all
static void Main(string[] args) {
Galleta galletita = new Galleta();
int numeroIngredientes = 0;
string usuarioNumeroIngrediente;
Console.WriteLine("Calorías: "+galletita.Calorias );
Console.WriteLine("Cubierta " + galletita.Cubierta);
Console.WriteLine("Sabor: " + galletita.Sabor);
Console.WriteLine("Definir cantidad de ingredientes:");
usuarioNumeroIngrediente = Console.ReadLine();
if (int.TryParse(usuarioNumeroIngrediente, out numeroIngredientes)) {
galletita.InicializaIngredientes(numeroIngredientes);
galletita.LeerIngredientes();
galletita.ImprimirIngredientes();
}
else { Console.WriteLine("error al leer los datos"); }
}
}
}
class Galleta {
private string sabor;
private int calorias;
private bool cubierta;
private float peso;
private double precio;
private char tamano;
private uint chips;
private decimal cantidad_de_chocolate;
private byte peso_harina;
private ushort capas;
private long cantidad_de_sodio;
private string[] ingredientes;
public Galleta(string sabor, decimal cantidad_de_chocolate) {
Sabor = sabor;
Cantidad_de_chocolate = cantidad_de_chocolate;
}
public Galleta() {
sabor = "vainilla";
}
public Galleta(bool cubierta, float peso) {
Cubierta = cubierta;
Peso = peso;
}
public Galleta(uint chips) {
Chips = chips;
}
public Galleta(ushort capas) {
peso = capas * peso;
}
public Galleta(long cantidad_de_sodio)
{
Cantidad_de_sodio = cantidad_de_sodio;
}
public void InicializaIngredientes(int numero_ingredientes)
{
ingredientes = new string[numero_ingredientes];
}
public void LeerIngredientes()
{
for (int i = 0; i < ingredientes.Length; i++)
{
Console.WriteLine("Ingrese el ingrediente: " + (i+1));
ingredientes[i] = Console.ReadLine();
}
}
public void ImprimirIngredientes()
{
for (int i = 0; i < ingredientes.Length; i++)
{
Console.WriteLine(ingredientes[i]);
}
}
public string Sabor { get => sabor; set => sabor = value; }
public int Calorias { get => calorias; set => calorias = value; }
public decimal Cantidad_de_chocolate { get => cantidad_de_chocolate; set => cantidad_de_chocolate = value; }
public double Precio { get => precio; set => precio = value; }
public uint Chips { get => chips; set => chips = value; }
public bool Cubierta { get => cubierta; set => cubierta = value; }
public float Peso { get => peso; set => peso = value; }
public ushort Capas { get => capas; set => capas = value; }
public long Cantidad_de_sodio { get => cantidad_de_sodio; set => cantidad_de_sodio = value; }
public string[] Ingredientes { get => ingredientes; set => ingredientes = value; }
}
Daniel Vega Balbin
Programación y diseño orientado a objetos

-
fellurchin
- Posts: 10
- Joined: Thu Jul 26, 2018 6:30 am
Post
by fellurchin » Thu Aug 30, 2018 8:32 am
Restaurante
Diagrama en papel.
Clouds Mikhail Yuryevich Lermontov
Codigo:
Marca:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Marca
{
private string cadena;
private Restaurante[] sede;
public Marca() { }
public string Cadena { get => cadena; set => cadena = value; }
internal Restaurante[] Sede { get => sede; set => sede = value; }
}
}
Restaurante:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Restaurante
{
private Menu carta;
private Mesero[] empleado1;
private Cocinero empleado2;
public Restaurante() { }
public Menu Carta { get => carta; set => carta = value; }
public Cocinero Empleado2 { get => empleado2; set => empleado2 = value; }
internal Mesero[] Empleado1 { get => empleado1; set => empleado1 = value; }
}
}
Mesero:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Mesero
{
private string nombre;
private bool disponible;
public Mesero() { }
public string Nombre { get => nombre; set => nombre = value; }
public bool Disponible { get => disponible; set => disponible = value; }
public void Servir(string[] pedido)
{
}
public int Cobrar(int mesa)
{
return 3;
}
}
}
Cocinero:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Cocinero
{
private string nombre;
private string[] platos;
public string Nombre { get => nombre; set => nombre = value; }
public string[] Platos { get => platos; set => platos = value; }
public Cocinero() { }
public void Cocinar(string comida)
{
}
}
}
Menú:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Menu
{
private PlatoPrincipal[] plato;
private Bebida[] liquido;
public Menu() { }
public PlatoPrincipal[] Plato { get => plato; set => plato = value; }
public Bebida[] Liquido { get => liquido; set => liquido = value; }
}
}
Plato principal:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class PlatoPrincipal
{
private string nombre;
private int costo;
public PlatoPrincipal() { }
public string Nombre { get => nombre; set => nombre = value; }
public int Costo { get => costo; set => costo = value; }
}
}
Bebida:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tarea
{
class Bebida
{
private string nombre;
private int costo;
private string tipo;
public Bebida() { }
public string Nombre { get => nombre; set => nombre = value; }
public int Costo { get => costo; set => costo = value; }
public string Tipo { get => tipo; set => tipo = value; }
}
}
"Si te he fallado te pido perdón de la única forma que es, abriendo las puertas de mi corazon para cuando decidas volver. Yo solo quiero tu amistad." -Albert Einstein
----
Jose Luis Victoria V.
Programacion y diseño orientado a objetos
-
atv234
- Posts: 78
- Joined: Tue Jan 19, 2016 12:05 pm
Post
by atv234 » Thu Aug 30, 2018 10:56 pm
Daniel Vega Balbin
Programación y diseño orientado a objetos

-
ScarHand420
- Posts: 24
- Joined: Thu Jul 26, 2018 6:24 am
Post
by ScarHand420 » Thu Aug 30, 2018 11:29 pm
Diagrama de clase - Restaurante.
Proyecto disponible en GitHub.
https://github.com/ScarHand420/POO
Bebida
Code: Select all
class Bebida
{
private string tipo;
private bool tiene_gas;
private bool fria;
}
Cliente
Code: Select all
class Cliente
{
private string nombre;
public Pedido HacerPedido()
{
return new Pedido();
}
public Mesa TomarMesa()
{
return new Mesa();
}
}
Cocinero
Code: Select all
class Cocinero
{
public void RecibirPedido(Pedido pedido)
{
}
public Pedido CocinarPedido(Pedido pedido)
{
return new Pedido();
}
}
Mesa
Code: Select all
class Mesa
{
private int numero;
private int sillas;
private bool para_bebe;
}
Mesero
Code: Select all
class Mesero
{
public void TomarPedido()
{
}
public Pedido LlevarPedido()
{
return new Pedido();
}
}
Pedido
Code: Select all
class Pedido
{
private Plato plato;
private Bebida bebida;
}
Plato
Code: Select all
class Plato
{
private bool tiene_arroz;
private bool tiene_carne;
private bool tiene_pasta;
}
Carlos Andrés Morales Albarán
- Programación y diseño orientado a objetos.
"~CY@~"
-NB3-
-
Juanlasso
- Posts: 13
- Joined: Thu Jul 26, 2018 6:24 am
Post
by Juanlasso » Thu Aug 30, 2018 11:50 pm
Code: Select all
class Restaurante
{
public bool lugar_donde_comer;
public bool servicio_rapido;
Cocinero Cocinar;
Mesero Atender;
Domiciliario Domicilio;
Servicios_varios Limpiar;
}
Code: Select all
class Mesero
{
public string atender;
public string Tomar_orden;
public string Decir_donde_limpiar;
public string Informar_domicilio;
Restaurante Lugar_donde_comer;
}
Code: Select all
class Domiciliario
{
public string Domicilio;
Mesero informar_domicilio;
}
Code: Select all
class Cocinero
{
public string Cocinar;
Mesero Tomar_orden;
Servicios_varios Limpiar_cocina;
}
Code: Select all
class Servicios_varios
{
public string Limpiar;
public string Limpiar_Cocina;
Mesero Decir_donde_limpiar;
}
"Anime was a mistake" Hayao Miyasaki
"Those who identify as "otaku", they sicken me deeply" also Hayao Miyasaki
-------
Juan Camilo Lasso Gutierrez
Programación Orientada a Objetos
-
Anjaerza
- Posts: 15
- Joined: Thu Jul 26, 2018 6:24 am
Post
by Anjaerza » Mon Sep 03, 2018 5:42 pm
Diagrama
Restaurante
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Restaurante
{
class Restoran
{
private Cliente[] clientes;
private Mesero[] meseros;
private string[] cuentas;
private Mesa[] mesas;
private bool abierto;
private Item[] menu;
}
}
Cliente
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Restaurante
{
class Cliente
{
string nombre;
int documento;
string metodopago;
bool reserva;
}
}
Item
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Restaurante
{
class Item
{
string nombre;
string ingredientes;
string tipo;
int precio;
}
}
Mesa
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Restaurante
{
class Mesa
{
int numero;
Item[] orden;
string estado;
int comensales;
bool limpia;
}
}
Mesero
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Restaurante
{
class Mesero
{
string nombre;
bool disponible;
Mesa[] mesasasignadas;
}
}
Andrés Javier Eraso Zambrano
-
checholiolinares
- Posts: 26
- Joined: Thu Jul 26, 2018 6:24 am
Post
by checholiolinares » Mon Sep 03, 2018 9:52 pm
Restaurante
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Restaurante
{
private Mesero[] meseros;
private Caja caja;
private Alimento[] menu;
private Mesa[] mesas;
private Ingrediente[] despensa;
private bool estado;
public Restaurante()
{
}
public void Abrir(float hora, int dia)
{
}
public void Cerrar(float hora)
{
}
public bool Estado { get => estado; set => estado = value; }
internal Mesero[] Meseros { get => meseros; set => meseros = value; }
internal Caja Caja { get => caja; set => caja = value; }
internal Alimento[] Menu { get => menu; set => menu = value; }
internal Mesa[] Mesas { get => mesas; set => mesas = value; }
internal Ingrediente[] Despensa { get => despensa; set => despensa = value; }
}
}
Mesero
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Mesero
{
private bool disponible;
private Alimento[] orden;
public Mesero() {
}
public void TomarOrden(Alimento comida)
{
}
public void Servir()
{
}
public bool Disponible { get => disponible; set => disponible = value; }
internal Alimento[] Orden { get => orden; set => orden = value; }
}
}
Caja
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Caja
{
private int dinero;
private int deudas;
public Caja()
{
}
public void Vendewr(Alimento[] orden)
{
}
public void Comprar()
{
}
public int Dinero { get => dinero; set => dinero = value; }
public int Deudas { get => deudas; set => deudas = value; }
}
}
Alimento
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Alimento
{
private int precio;
private Ingrediente[] ingredientes;
private string nombre;
private bool frio;
public Alimento()
{
}
public int Precio { get => precio; set => precio = value; }
public string Nombre { get => nombre; set => nombre = value; }
public bool Frio { get => frio; set => frio = value; }
internal Ingrediente[] Ingredientes { get => ingredientes; set => ingredientes = value; }
}
}
Mesa
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Mesa
{
private bool ocupada;
private bool atendida;
private int fase;
public Mesa()
{
}
public void Reserva()
{
}
public bool Ocupada { get => ocupada; set => ocupada = value; }
public bool Atendida { get => atendida; set => atendida = value; }
public int Fase { get => fase; set => fase = value; }
}
}
Ingrediente
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestauranteEjercicio
{
class Ingrediente
{
private string nombre;
private float tiempoPerecer;
public Ingrediente()
{
}
public void CalculaFechaVencimiento()
{
}
public string Nombre { get => nombre; set => nombre = value; }
public float TiempoPerecer { get => tiempoPerecer; set => tiempoPerecer = value; }
}
}
Relaciones

Sergio Felipe Pañaloza Herrera
Programación y diseño orientado a objetos

-
LaLeal
- Posts: 13
- Joined: Thu Jul 26, 2018 6:27 am
Post
by LaLeal » Mon Sep 03, 2018 10:17 pm
Diagrama de clases Restaurante
Código
Code: Select all
class Program
{
static void Main(string[] args)
{
cliente valentina = new cliente(); }
}
}
Clase Cliente
Code: Select all
class cliente
{
private int numero_mesa;
private int numero_personas;
private Cuenta cuenta;
public int Numero_mesa { get => numero_mesa; set => numero_mesa = value; }
public int Numero_personas { get => numero_personas; set => numero_personas = value; }
internal Cuenta Cuenta { get => cuenta; set => cuenta = value; }
public cliente ()
{
numero_mesa = 0;
numero_personas = 0;
cuenta = new Cuenta();
}
private void PagarCuenta(Cuenta cuenta)
{
}
}
Clase Orden
Code: Select all
class Orden
{
private string mesero;
private int hora_pedido;
private Bebida bebida;
private Plato platillo;
public string Mesero { get => mesero; set => mesero = value; }
public int Hora_pedido { get => hora_pedido; set => hora_pedido = value; }
internal Bebida Bebida { get => bebida; set => bebida = value; }
internal Plato Platillo { get => platillo; set => platillo = value; }
public Orden()
{
mesero = "";
hora_pedido = 0;
bebida = new Bebida();
platillo = new Plato();
}
private string Pedido (Bebida bebida, Plato platillo)
{
return "";
}
}
Clase Bebida
Code: Select all
class Bebida
{
private string tipo_Bebida;
private int precio;
public string Tipo_Bebida { get => tipo_Bebida; set => tipo_Bebida = value; }
public int Precio { get => precio; set => precio = value; }
public Bebida()
{
Tipo_Bebida = "";
Precio = 0;
}
private void Guardar_Pedido (string tipo_Bebida, int precio)
{
}
}
Clase Plato
Code: Select all
class Plato
{
private string tipo_Plato;
private int precio;
public string Tipo_Plato { get => tipo_Plato; set => tipo_Plato = value; }
public int Precio { get => precio; set => precio = value; }
public Plato ()
{
tipo_Plato = "";
precio = 0;
}
private void Guardar_Pedido(string tipo_Plato, int precio)
{
}
}
Clase Cuenta
Code: Select all
class Cuenta
{
private double valor_pedido;
private double propina;
private double impuestos;
private Orden orden;
private void Total_Pago (double valor_pedido, double propina, double impuestos)
{
}
}
-
Blackbeast17
- Posts: 4
- Joined: Thu Jul 26, 2018 6:25 am
Post
by Blackbeast17 » Wed Sep 05, 2018 9:06 pm
Restaurante
Mesa
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp17
{
class Mesa
{
private string color;
private int numero_patas;
private Silla numero_sillas;
private string material;
private float tamaño;
public string Color { get => color; set => color = value; }
public int Numero_patas { get => numero_patas; set => numero_patas = value; }
public Sillas Numero_sillas { get => numero_sillas; set => numero_sillas = value; }
public string Material { get => material; set => material = value; }
public float Tamaño { get => tamaño; set => tamaño = value; }
public bool Servir() { return true; }
public bool Rodar() { return false; }
public bool Mover() { return true; }
}
}
Silla
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp17
{
class Silla
{
private string color;
private int numero_patas;
private bool tiene_ruedas;
private float maximo_peso;
private string material;
public string Color { get => color; set => color = value; }
public int Numero_patas { get => numero_patas; set => numero_patas = value; }
public bool Tiene_ruedas { get => tiene_ruedas; set => tiene_ruedas = value; }
public float Maximo_peso { get => maximo_peso; set => maximo_peso = value; }
public string Material { get => material; set => material = value; }
public void Sentar(){ }
public bool Ocupar() { return true; }
public bool Rodar() {return false; }
}
}
Cuenta
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp17
{
class Cuenta
{
private string material;
private int cantidad_comida;
private float total;
private float tamaño;
private int iva;
public string Material { get => material; set => material = value; }
public int Cantidad_comida { get => cantidad_comida; set => cantidad_comida = value; }
public float Total { get => total; set => total = value; }
public float Tamaño { get => tamaño; set => tamaño = value; }
public int Iva { get => iva; set => iva = value; }
public bool Pagar() { return true; }
public void Guardar() { }
public void Registrar() { }
}
}
Mesero
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp17
{
class Mesero
{
private string nombre;
private float estatura;
private int numero_manos;
private int numero_piernas;
private bool tiene_uniforme;
public string Nombre { get => nombre; set => nombre = value; }
public float Estatura { get => estatura; set => estatura = value; }
public int Numero_manos { get => numero_manos; set => numero_manos = value; }
public int Numero_piernas { get => numero_piernas; set => numero_piernas = value; }
public bool Tiene_uniforme { get => tiene_uniforme; set => tiene_uniforme = value; }
public void Simpatizar() { }
public void Atender() { }
public void Saludar() { }
}
}
Comida
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp17
{
class Comida
{
private string sabor;
private string nombre;
private int cantidad;
private float tamaño;
private Cuenta precio;
public string Sabor { get => sabor; set => sabor = value; }
public string Nombre { get => nombre; set => nombre = value; }
public int Cantidad { get => cantidad; set => cantidad = value; }
public float Tamaño { get => tamaño; set => tamaño = value; }
public CuentaPrecio { get => precio; set => precio = value; }
public bool Llenar() { return true; }
public bool Calentar() { return false; }
public bool Satisfacer() { return true; }
}
}