Advertisement
diogoiub

Aula01

May 9th, 2022 (edited)
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Aula01Atividade01
  8. {
  9.     class Pessoa
  10.     {
  11.         //Atributos
  12.         public string nome;
  13.         public int idade;
  14.  
  15.         //Metodos
  16.         public void mensagem()
  17.         {
  18.             Console.WriteLine("Olá "+nome+" sua idade é "+idade+" anos");
  19.             Console.ReadKey();
  20.         }
  21.  
  22.     }
  23.  
  24. }
  25. -------------------------------------------------------------------------------------------
  26. using System;
  27. using System.Collections.Generic;
  28. using System.Linq;
  29. using System.Text;
  30. using System.Threading.Tasks;
  31.  
  32. namespace Aula01Atividade01
  33. {
  34.     class Program
  35.     {
  36.         static void Main(string[] args)
  37.         {
  38.             Pessoa objeto = new Pessoa();
  39.             objeto.nome = "Diogo";
  40.             objeto.idade = 37;
  41.             objeto.mensagem();
  42.            
  43.  
  44.         }
  45.     }
  46. }
  47. ============================================================================================================================
  48.  
  49. using System;
  50. using System.Collections.Generic;
  51. using System.Linq;
  52. using System.Text;
  53. using System.Threading.Tasks;
  54.  
  55. namespace Aula01Atividade02
  56. {
  57.     class Aluno
  58.     {
  59.         //Atributos
  60.         public string nome;
  61.         public double nota1, nota2;
  62.  
  63.         //Métodos
  64.        
  65.         //Media
  66.         public double media()
  67.         {
  68.             double mediaNota = (nota1 + nota2)/2;
  69.             return mediaNota;
  70.         }
  71.         //Situação
  72.         public string situacao(double mediaNota)
  73.         {
  74.             string SituacaoAluno;
  75.  
  76.             if(mediaNota >= 7)
  77.             {
  78.                 SituacaoAluno = "Aprovado";
  79.             }
  80.             else
  81.             {
  82.                 SituacaoAluno = "Reprovado";
  83.             }
  84.  
  85.             return SituacaoAluno;
  86.         }
  87.  
  88.         //Mensagem
  89.         public void mensagem()
  90.         {
  91.             //objter a média
  92.             double obterMedia = media();
  93.  
  94.             //obter a situação
  95.             string obterSituacao = situacao(obterMedia);
  96.  
  97.             //Mensagem
  98.             Console.WriteLine(nome+" esta "+obterSituacao+" com média "+obterMedia);
  99.         }
  100.     }
  101. }
  102. -------------------------------------------------------------------------------------------------------------------------
  103. using System;
  104. using System.Collections.Generic;
  105. using System.Linq;
  106. using System.Text;
  107. using System.Threading.Tasks;
  108.  
  109. namespace Aula01Atividade02
  110. {
  111.     class Program
  112.     {
  113.         static void Main(string[] args)
  114.         {
  115.             Aluno Aluno1 = new Aluno();
  116.             Aluno1.nome = "Diogo Cavalcante";
  117.             Aluno1.nota1 = 8;
  118.             Aluno1.nota2 = 5;
  119.             Aluno1.mensagem();
  120.             Console.ReadKey();
  121.         }
  122.     }
  123. }
  124. =================================================================================================================================
  125. using System;
  126. using System.Collections.Generic;
  127. using System.Linq;
  128. using System.Text;
  129. using System.Threading.Tasks;
  130.  
  131. namespace Aula01Atividade03
  132. {
  133.     class Pessoa
  134.     {
  135.         //Atributos
  136.         public string nome;
  137.         public double peso, altura;
  138.        
  139.         // Metodos
  140.         // Media
  141.         public double imc()
  142.         {
  143.             double calImc = Math.Round(peso /(altura * altura), 2);
  144.             return calImc;
  145.         }
  146.         public string situacao(double calImc)
  147.         {
  148.             string situacaoIMC;
  149.  
  150.             if(calImc < 18.5)
  151.             {
  152.                 situacaoIMC = "Abaixo do peso";
  153.             }
  154.             else if (calImc < 25)
  155.             {
  156.                 situacaoIMC = "com Peso Normal";
  157.             }
  158.             else if (calImc < 30)
  159.             {
  160.                 situacaoIMC = "Acima do peso";
  161.             }
  162.             else if (calImc < 35)
  163.             {
  164.                 situacaoIMC = "com Obesidade I";
  165.             }
  166.             else if (calImc < 40)
  167.             {
  168.                 situacaoIMC = "com Obesidade II";
  169.             }
  170.             else{
  171.                 situacaoIMC = "com Obesidade III";
  172.             }
  173.  
  174.             return situacaoIMC;
  175.         }
  176.  
  177.         public void mensagem()
  178.         {
  179.             //obter IMC
  180.             double obterImc = imc();
  181.  
  182.             string obterSituacao = situacao(obterImc);
  183.  
  184.             //Mensagem
  185.  
  186.             Console.WriteLine(nome+" seu IMC é "+obterImc+" por isso esta "+obterSituacao);
  187.            
  188.         }
  189.  
  190.     }
  191.    
  192.  
  193. }
  194. -----------------------------------------------------------------------------------------------------------------------------
  195. using System;
  196. using System.Collections.Generic;
  197. using System.Linq;
  198. using System.Text;
  199. using System.Threading.Tasks;
  200.  
  201. namespace Aula01Atividade03
  202. {
  203.     class Program
  204.     {
  205.         static void Main(string[] args)
  206.         {
  207.             Pessoa objPes = new Pessoa();
  208.             objPes.nome = "Fulando";
  209.             objPes.peso = 105;
  210.             objPes.altura = 1.85;
  211.             objPes.mensagem();
  212.             Console.ReadKey();
  213.  
  214.         }
  215.     }
  216. }
  217.  
  218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement