Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SimiUnadm
- {
- public class RecetaMedica
- {
- private string medicamentoAsurtir;
- private int cantidad;
- private string forma;
- private double dosis;
- private DateTime fechaInicial;
- private DateTime fechaFinal;
- private double precio;
- //contructor
- public RecetaMedica() //se inicializan las variables en 0
- {
- this.MedicamentoAsurtir = "";
- this.Forma = "";
- this.Cantidad = 0;
- this.Dosis = 0.0;
- this.Precio = 0.0;
- }
- ~RecetaMedica() //destructor o finalizador
- {
- this.MedicamentoAsurtir = "";
- this.Forma = "";
- this.Cantidad = 0;
- this.Dosis = 0.0;
- this.Precio = 0.0;
- }
- public string MedicamentoAsurtir { get => medicamentoAsurtir; set => medicamentoAsurtir = value; }
- public int Cantidad { get => cantidad; set => cantidad = value; }
- public string Forma { get => forma; set => forma = value; }
- public double Dosis { get => dosis; set => dosis = value; }
- public DateTime FechaInicial { get => fechaInicial; set => fechaInicial = value; }
- public DateTime FechaFinal { get => fechaFinal; set => fechaFinal = value; }
- public double Precio { get => precio; set => precio = value; }
- //métodos
- public double obtenerMontoReceta()
- {
- if (this.Cantidad < 0)
- {
- this.Cantidad = 0;
- }
- if (this.Precio < 0)
- {
- this.Precio = 0.0;
- }
- double monto = this.Cantidad * this.Precio;
- return monto;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment