# Final Session | Fundamentos da Lógica **Nome:** Murillo Tadeu Olveira **Número:** 33 **Turma:** Info D ## Nível 1 ### Exercício 1 ```csharp= public double tri(double b, double h) { double area = b + h; return area; } double teste = tri(15, 10); teste = 25 ``` ### Exercício 3 ```csharp= public int octógono(int l) { int perimetro = l * 8; return perimetro; } int teste = octógono(8); teste = 64 ``` ### Exercício 4 ```csharp= public double trap(double maior, double menor, double altura) { double calculoa1 = (maior + menor) * altura; double calculoa2 = calculoa1 / 2; return calculoa2; } double teste = trap(3, 2, 2); teste = 5 ``` ## Nível 2 ### Exercício 1 ```csharp= public double hip(double c.oposto, double c.adjacente) { double oposto = Math.Pow(c.oposto, 2); double adjacente = Math.Pow(c.adjacente, 2); double calculo1 = oposto + adjacente; double calculo2 = Math.Sqrt(calculo1); return calculo2; } double teste = hip=(8, 6); teste = 10 ``` ### Exercício 2 ```csharp= public double IMC(double p, double a) { double calculo1 = Math.Pow(a, 2); double calculo2 = p / calculo1; double arredondar = Math.Round(calculo2, 2); return arredondar; } double teste = IMC(80, 1.70); teste = 47,05 ``` ### Exercício 3 ```csharp= public double capital(double valor, int parcelas, double juros) { double j = juros + 1; double numero = Math.Pow(j,parcelas); double total = valor * numero; double arredondar = Math.Round(t, 1); return arredondar; } double teste = capital(400, 2, 0.04); teste = 432.6 ``` ### Exercício 4 ```csharp= public double cil(double r, double a) . { . double calculo1 = Math.Pow(r, 2); . double calculo2 = 3.14 * calculo1 * a; . return calculo2; . } . . double teste = cil(2, 6); . teste 75,36 ``` ## Nível 3 ### Exercício 1 ```csharp= public string primeironome (string nome1) { int espaco = nome1.IndexOf(" "); int nome2 = nome1.Length; string sobrenome = nome1.Substring(0,espaco); string nome3 = sobrenome.Trim(); return nome3; } string teste = primeironome ("Adolfo Pinheiro da Silva"); teste = Adolfo ``` ### Exercício 2 ```csharp= public string ultimonome (string nome1) { int espaco = nome1.LastIndexOf(" "); int nome2 = nome1.Length; string sobrenome = nome1.Substring(espaco,nome1-espaco); string ultimo = sobrenome.Trim(); return ultimo; } string teste = ultimonome ("Murillo Tadeu Oliveira"); teste = Oliveira ``` ### Exercício 3 ```csharp= public string dominio (string email) { int a = email.LastIndexOf("@"); int b = email.Length; string c = email.Substring(a,b-a); return c; } string teste = dominio ("murillotadeu@gmail.com"); teste ``` ### Exercício 5 ```csharp= public string telefone(string numero1) { string numero2 = numero1.Replace ("(", ""); numero2 = numero2.Replace(")", ""); numero2 = numero2.Replace("-", ""); return numero2; } string teste = telefone("(11)98469-0364"); teste = 11984690364 ``` ## Nível 4 ### Exercício 1 ```csharp= public DateTime ultimo (DateTime data) { DateTime fim1 = data.AddMonths(1); int fim2 = data.Day; DateTime fim3 = fim1.AddDays(-dat); return fim3; } DateTime ultimo = new DateTime(2021,4,15); DateTime teste = ultimo(dia); ultimo = 4/30/2021 ``` ### Exercício 2 ```csharp= public DateTime primeiro (DateTime data) { DateTime prox1 = new DateTime(data.Year, data.Month, 1); DateTime prox2 = date.AddMonths(1); return prox2; } DateTime hoje = DateTime.Now; DateTime teste = PrimeiroDiaMes(hoje); teste = 5/1/2021 ``` ### Exercício 3 ```csharp= public bool trimestre (DateTime data) { int mes1 = data.Month; bool mes2 = mes1 >= 4 && mes1 <=6; return mes2; } DateTime hoje = new DateTime(2021,04,15); bool teste = trimestre(mes); teste = true ``` ### Exercício 5 ```csharp= public bool quinzena (DateTime data) { return data.Day <= 15; } DateTime hoje = new DateTime(2021,04,15); bool teste = quinzena(hoje); teste = true ``` ## Nível 5 ### Exercício 2 ```csharp= public double PA (double primeiro, double razao, double posicao) { double resposta = primeiro + (calculo(posicao, razao)); return resposta; } public double calculo (double p, double r) { double calculo1 = (p - 1) * r; return calculo1; } double teste = PA(4, 2, 8); teste = 18 ``` ### Exercício 3 ```csharp= public double PG (double primeiro, double razao, double posicao) { double calculo1 = Math.Pow(razao, posicao); double calculo2 = primeiro * calculo1; return calculo2; } public double potencia (double a, double b) { double x = Math.Pow(a,b-1); return x; } double teste = PG(4, 2, 8); teste = 512 ``` ### Exercício 4 ```csharp= public bool familia (string nome1, string nome2) { string primeirosobrenome = lastname(nome1); string segundosobrenome = lastname(nome2); bool comparacao = primeirosobrenome == segundosobrenome; return comparacao; } public string lastname (string a) { int espaço = a.LastIndexOf(" "); int nome = a.Length; string sobrenome = a.Substring(espaço,nome-espaço); string ultimo = sobrenome.Trim(); return ultimo; } string nome1 = "Mariana Coelho"; string nome2 = "Laura Coelho"; bool teste = SobrenomeIgual(nome1, nome2); teste = true ``` ### Exercício 5 ```csharp= public bool libra (DateTime data1, DateTime data2) { bool j = comparar (data1); bool k = comparar (data2); bool l = j == k; return l; } public bool comparar(DateTime z) { DateTime x = new DateTime(z.Year,09,23); DateTime y = new DateTime(z.Year,10,22); bool comparacao = z >= x && z <= h; return comparacao; } DateTime date1 = new DateTime(2021,10,13); DateTime date2 = new DateTime(2004,10,18); bool teste = Tempolibra (date1, date2); teste = true ```
{"metaMigratedAt":"2023-06-15T23:05:57.316Z","metaMigratedFrom":"Content","title":"Final Session | Fundamentos da Lógica","breaks":true,"contributors":"[{\"id\":\"ddf4ea40-fb01-4dc1-b147-92a7051a20c0\",\"add\":14792,\"del\":8790}]"}
Expand menu