Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Atividade6Ex1
- {
- abstract public class Veiculo
- {
- protected int velocidade_max;
- protected int velocidade_atual;
- protected bool ligado;
- protected string tipo_energia;
- protected string combustível;
- protected int potencia;
- public Veiculo()
- {
- ligado = true;
- }
- }
- abstract public class Veiculo_Terrestre : Veiculo
- {
- protected int qnt_rodas;
- protected int qnt_portas;
- abstract public void Potencia(int potencia);
- abstract public void Qnt_Rodas(int qnt_rodas);
- abstract public void Qnt_Portas(int qnt_portas);
- abstract public void Tipo_Energia(string tipo_energia);
- abstract public void Combustivel(string combustivel);
- abstract public void Velocidade_Max(int velocidade_max);
- abstract public void Velocidade_Atual(int velocidade_atual);
- }
- abstract public class Veiculo_Aereo : Veiculo
- {
- protected int qnt_rodas;
- protected int qnt_portas;
- protected int altura_max;
- abstract public void Potencia(int potencia);
- abstract public void Qnt_Rodas(int qnt_rodas);
- abstract public void Qnt_Portas(int qnt_portas);
- abstract public void Altura_Max(int altura_max);
- abstract public void Tipo_Energia(string tipo_energia);
- abstract public void Combustivel(string combustivel);
- abstract public void Velocidade_Max(int velocidade_max);
- abstract public void Velocidade_Atual(int velocidade_atual);
- }
- abstract public class Veiculo_Aquatico : Veiculo
- {
- protected int peso_max;
- protected int profundidade_max;
- protected string tipo_agua;
- abstract public void Potencia(int potencia);
- abstract public void Tipo_Energia(string tipo_energia);
- abstract public void Combustivel(string combustivel);
- abstract public void Peso_Max(int peso_max);
- abstract public void Profundidade_Max(int profundidade_max);
- abstract public void Tipo_Agua(string tipo_agua);
- abstract public void Velocidade_Max(int velocidade_max);
- abstract public void Velocidade_Atual(int velocidade_atual);
- }
- abstract public class Veiculo_Animal : Veiculo
- {
- protected bool vivo;
- protected int peso_max;
- protected int qnt_patas;
- protected string especie;
- protected string alimentacao;
- abstract public void Vivo(bool vivo);
- abstract public void Qnt_Patas(int qnt_patas);
- abstract public void Especie(string especie);
- abstract public void Alimentacao(string alimentacao);
- abstract public void Potencia(int potencia);
- abstract public void Tipo_Energia(string tipo_energia);
- abstract public void Combustivel(string combustivel);
- abstract public void Peso_Max(int peso_max);
- abstract public void Velocidade_Max(int velocidade_max);
- abstract public void Velocidade_Atual(int velocidade_atual);
- }
- abstract public class Veiculo_Anfibio : Veiculo
- {
- protected int qnt_rodas;
- protected int qnt_portas;
- protected int peso_max;
- protected int profundidade_max;
- protected string tipo_agua;
- abstract public void Peso_Max(int peso_max);
- abstract public void Profundidade_Max(int profundidade_max);
- abstract public void Tipo_Agua(string tipo_agua);
- abstract public void Potencia(int potencia);
- abstract public void Qnt_Rodas(int qnt_rodas);
- abstract public void Qnt_Portas(int qnt_portas);
- abstract public void Tipo_Energia(string tipo_energia);
- abstract public void Combustivel(string combustivel);
- abstract public void Velocidade_Max(int velocidade_max);
- abstract public void Velocidade_Atual(int velocidade_atual);
- }
- public class Carro : Veiculo_Terrestre
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get {return nome;}
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Moto : Veiculo_Terrestre
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Bicicleta : Veiculo_Terrestre
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Caminhao : Veiculo_Terrestre
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Navio : Veiculo_Aquatico
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Peso_Max(int peso_max)
- {
- this.peso_max = peso_max;
- }
- override public void Profundidade_Max(int profundidade_max)
- {
- this.profundidade_max = profundidade_max;
- }
- override public void Tipo_Agua(string tipo_agua)
- {
- this.tipo_agua = tipo_agua;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Submarino : Veiculo_Aquatico
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Peso_Max(int peso_max)
- {
- this.peso_max = peso_max;
- }
- override public void Profundidade_Max(int profundidade_max)
- {
- this.profundidade_max = profundidade_max;
- }
- override public void Tipo_Agua(string tipo_agua)
- {
- this.tipo_agua = tipo_agua;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Cavalo : Veiculo_Animal
- {
- private string nome;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- override public void Vivo(bool vivo)
- {
- this.vivo = vivo;
- }
- override public void Qnt_Patas(int qnt_patas)
- {
- this.qnt_patas = qnt_patas;
- }
- override public void Especie(string especie)
- {
- this.especie = especie;
- }
- override public void Alimentacao(string alimentacao)
- {
- this.alimentacao = alimentacao;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Peso_Max(int peso_max)
- {
- this.peso_max = peso_max;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Aviao : Veiculo_Aereo
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Altura_Max(int altura_max)
- {
- this.altura_max = altura_max;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Helicoptero : Veiculo_Aereo
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Altura_Max(int altura_max)
- {
- this.altura_max = altura_max;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- public class Anfibio : Veiculo_Anfibio
- {
- private string nome;
- private string marca;
- public string nome_p
- {
- get { return nome; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- nome = value;
- }
- }
- } //get set nome.
- public string marca_p
- {
- get { return marca; }
- set
- {
- if (value.Length > 3 && value.Length < 12)
- {
- marca = value;
- }
- }
- } //get set marca.
- override public void Peso_Max(int peso_max)
- {
- this.peso_max = peso_max;
- }
- override public void Profundidade_Max(int profundidade_max)
- {
- this.profundidade_max = profundidade_max;
- }
- override public void Tipo_Agua(string tipo_agua)
- {
- this.tipo_agua = tipo_agua;
- }
- override public void Qnt_Rodas(int qnt_rodas)
- {
- this.qnt_rodas = qnt_rodas;
- }
- override public void Qnt_Portas(int qnt_portas)
- {
- this.qnt_portas = qnt_portas;
- }
- override public void Tipo_Energia(string tipo_energia)
- {
- this.tipo_energia = tipo_energia;
- }
- override public void Combustivel(string combustivel)
- {
- this.combustível = combustivel;
- }
- override public void Potencia(int potencia)
- {
- this.potencia = potencia;
- }
- override public void Velocidade_Max(int velocidade_max)
- {
- if (velocidade_max > 0)
- {
- this.velocidade_max = velocidade_max;
- }
- else
- {
- this.velocidade_max = 0;
- }
- }
- override public void Velocidade_Atual(int velocidade_atual)
- {
- if (velocidade_atual > 0)
- {
- this.velocidade_atual = velocidade_atual;
- }
- else
- {
- this.velocidade_atual = 0;
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Carro carro1 = new Carro();
- carro1.marca_p = "Volkswagen";
- carro1.nome_p = "Gol GTI 2.0";
- carro1.Qnt_Portas(2);
- carro1.Qnt_Rodas(4);
- carro1.Tipo_Energia("Combustão Interna");
- carro1.Combustivel("Gasolina");
- carro1.Potencia(120);
- carro1.Velocidade_Max(180);
- carro1.Velocidade_Atual(0);
- Cavalo cavalo1 = new Cavalo();
- cavalo1.nome_p = "Mustang";
- cavalo1.Vivo(true);
- cavalo1.Alimentacao("Herbívoro");
- cavalo1.Combustivel("Comida");
- cavalo1.Tipo_Energia("Mecânica");
- cavalo1.Especie("Equino");
- cavalo1.Qnt_Patas(4);
- cavalo1.Peso_Max(100);
- cavalo1.Potencia(1);
- cavalo1.Velocidade_Max(70);
- cavalo1.Velocidade_Atual(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement