Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Classe program//
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine(" *Opções* ");
- Console.WriteLine("Para abrir digite 1");
- Console.WriteLine("Para fechar digite 2");
- Console.WriteLine("Para colorir digite 3");
- Console.WriteLine("Para Alterar altura digite 4");
- Console.WriteLine("Para alterar largura digite 5");
- Console.WriteLine("Para alterar espessura digite 6");
- Console.WriteLine("Para sair digite 0");
- try
- {
- double op = double.Parse(Console.ReadLine());
- }
- catch {
- Console.Write("Opção incorreta!");
- }
- {
- throw;
- }
- Porta p = new Porta();
- p.Aberta = false;
- p.Cor = "Branco";
- p.DimensaoX = 180;
- p.DimensaoY = 4;
- p.DimensaoZ = 80;
- p.Abrir();
- p.Fechar();
- p.Pintar("Verde");
- p.Pintar("Azul");
- p.DimensaoX = 170;
- string isAberta = p.EstaAberta() ? "Sim" : "Não";
- Console.WriteLine("A porta está aberta? " + isAberta);
- }
- }
- }
- //Classe porta//
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication3
- {
- class Porta
- {
- public Boolean Aberta { get; set; }
- public string Cor { get; set; }
- public double DimensaoX { get; set; }
- public double DimensaoY { get; set; }
- public double DimensaoZ { get; set; }
- public Porta(double Porta, string Cor, double DimensaoX, double DimensaoY, double DimensaoZ)
- {
- this.Aberta = Aberta;
- this.Cor = Cor;
- this.DimensaoX = DimensaoX;
- this.DimensaoY = DimensaoY;
- this.DimensaoZ = DimensaoZ;
- }
- public void Abrir()
- {
- this.Aberta = true;
- }
- public void Fechar()
- {
- this.Aberta = false;
- }
- public void Pintar(string novaCor)
- {
- this.Cor = novaCor;
- }
- public Boolean EstaAberta()
- {
- return Aberta;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement