Advertisement
LightProgrammer000

POJO

Dec 6th, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.58 KB | None | 0 0
  1. // Bibliotecas
  2. using System;
  3.  
  4. // Programa
  5. namespace EX_03
  6. {
  7.     // Classe
  8.     public class Program_1
  9.     {
  10.         // Método Principal
  11.         public static void Main(string[] args)
  12.         {
  13.             // Construtor
  14.             Program_2 obj = new Program_2();
  15.  
  16.             Console.WriteLine("\n - Programa com 2 Classes [POJO] \n");
  17.  
  18.             // A
  19.             Console.Write("\n A: " + obj.getA() );
  20.             obj.setA("A");
  21.             Console.Write("\n A: " + obj.getA());
  22.  
  23.             // B
  24.             Console.Write("\n\n B: " + obj.getB());
  25.             obj.setB("B");
  26.             Console.Write("\n B: " + obj.getB());
  27.  
  28.             // C
  29.             Console.Write("\n\n C: " + obj.getC());
  30.             obj.setC("C");
  31.             Console.Write("\n C: " + obj.getC());
  32.  
  33.             // D
  34.             Console.Write("\n\n D: " + obj.getD());
  35.             obj.setD(10);
  36.             Console.Write("\n D: " + obj.getD());
  37.  
  38.             // E
  39.             Console.Write("\n\n E: " + obj.getE());
  40.             obj.setE(10.10f);
  41.             Console.Write("\n E: " + obj.getE());
  42.  
  43.             // F
  44.             Console.Write("\n\n F: " + obj.getF());
  45.             obj.setF(100.100);
  46.             Console.Write("\n F: " + obj.getF() + "\n");
  47.  
  48.             // Pulo de Linha
  49.             Console.ReadLine();
  50.         }
  51.     }
  52.  
  53.     // Classe: Modelo de Um Objeto
  54.     public class Program_2
  55.     {
  56.         string a = "a";
  57.         string b = "b";
  58.         string c = "c";
  59.         int d = 1;
  60.         float e = 2.0f;
  61.         double f = 3.0;
  62.  
  63.         // A
  64.         public string getA()
  65.         {
  66.             return a;
  67.         }
  68.  
  69.         public void setA(string a)
  70.         {
  71.             this.a = a;
  72.         }
  73.  
  74.         // B
  75.         public string getB()
  76.         {
  77.             return b;
  78.         }
  79.  
  80.         public void setB(string b)
  81.         {
  82.             this.b = b;
  83.         }
  84.  
  85.         // C
  86.         public string getC()
  87.         {
  88.             return c;
  89.         }
  90.  
  91.         public void setC( string c)
  92.         {
  93.             this.c = c;
  94.         }
  95.        
  96.         // D
  97.         public int getD()
  98.         {
  99.             return d;
  100.         }
  101.  
  102.         public void setD(int d)
  103.         {
  104.             this.d = d;
  105.         }
  106.  
  107.         // E
  108.         public float getE()
  109.         {
  110.             return e;
  111.         }
  112.  
  113.         public void setE(float e)
  114.         {
  115.             this.e = e;
  116.         }
  117.  
  118.         // F
  119.         public double getF()
  120.         {
  121.             return f;
  122.         }
  123.  
  124.         public void setF(double f)
  125.         {
  126.             this.f = f;
  127.         }
  128.     }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement