Isabela Silva Sousa
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Trabalho Super Bônus | Csharp autora: Isabela Silva Sousa [toc] ## Nível I ### Exercício 1 Faça uma função ÚNICA que a partir da base e altura, calcule a área do triângulo. ```csharp= public int FuncaoExemplo(int a, int b) { return a + b; } int x = FuncaoExemplo(10, 5); // 15 ``` ### Exercício 2 Faça uma função ÚNICA que a partir do lado, calcule o perímetro do octógono. ```csharp= public double CalcularPerimetroOctogono(double lado) { double perimetro = lado * 15; return perimetro; } double x = CalcularPerimetroOctogono(3); // 45 ``` ### Exercício 3 Faça uma função ÚNICA que a partir da base maior, base menor e altura, calcule a área do trapézio. ```csharp= public double CalcularAreaTrapezio (double A, int a, double h) { double bases = (A + a) * h; double area = bases/2; return area; } double x = CalcularAreaTrapezio(8, 2, 4); // 20 ``` ### Exercício 4 Faça uma função ÚNICA que a partir da diagonal maior e menor, calcule a área do losango. ```csharp= public double CalcularAreaLosangulo (double D, int d) { double diagonal = D + d; double area = diagonal/2; return area; } double x = CalcularAreaLosangulo(8, 7); // 7.5 ``` ## Nível II ### Exercício 1 Faça uma função ÚNICA que a partir do cateto oposto e adjacente, calcule a hipotenusa. Arredonde a resposta para uma casa decimal. ```csharp= public double CalcularHipotenusa (double co, double ca) { double co2 = Math.Pow(co,2); double ca2 = Math.Pow(ca,2); double hipo = co2 + ca2; double potenusa = Math.Sqrt(hipo); double h = Math.Round(potenusa,1); return h; } double x = CalcularHipotenusa (7, 14); // 15.7 ``` ### Exercício 2 Faça uma função ÚNICA que a partir de um peso e altura de uma pessoa, calcule o IMC. Arredonde a resposta para duas casas decimais. ```csharp= public double CalcularIMC (double peso, double altura) { double alt = Math.Pow(altura,2); double i = peso/alt; double total = Math.Round(i,2); return total; } double x = CalcularIMC (90, 2.60); // 13.31 ``` ### Exercício 4 Faça uma função ÚNICA que a partir da massa e velocidade, calcule a energia cinética. Obrigatório o uso da função Math.Pow. ```csharp= public double CalcularEnergiaCinetica (double m, double v) { double v2 = Math.Pow(v,2); double Ec = m * v2 / 2; return Ec; } double e = CalcularEnergiaCinetica(80000, 90); // 324000000 ``` ### Exercício 5 Faça uma função ÚNICA que a partir da altura e raio, calcule o volume de um cilindro. Obrigatório o uso da função Math.Pow. ```csharp= public double CalcularVolumeCilindro (double r, double h) { double r2 = Math.Pow(r,2); double pi = 3.14; double volume= pi * r2 * h ; return volume; } double V = CalcularVolumeCilindro (8, 2); // 401.92 ``` ## Nível III ### Exercício 1 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o primeiro nome. ```csharp= public string CalcularPrimeiroNome(string nome) { int D = nome.IndexOf(""); int espaço = nome.IndexOf(" "); string ultimo = nome.Substring(D, espaço); return ultimo; } string x = CalcularPrimeiroNome("Ana Luisa Partenazi Lopez"); x // Ana ``` ### Exercício 2 Faça uma função ÚNICA que a partir de um nome completo de uma pessoa, extraia o último nome. ```csharp= public string CalcularUltimoNome(string nome) { int espaço = nome.IndexOf(" "); string ultimo = nome.Substring(espaço); return ultimo; } string x = CalcularUltimoNome("Maria Ribeiro de Souza"); // Ribeiro de Souza ``` ### Exercício 3 Faça uma função ÚNICA que a partir de um e-mail de uma pessoa, extraia o domínio do e-mail. ```csharp= public string DominioEMAIL (string email) { string d = email.Substring(email.IndexOf('@')); return d; } string x = DominioEMAIL("isayogue@gmail.com.br"); //@gmail.com.br ``` ### Exercício 5 Faça uma função ÚNICA que a partir de um telefone com máscara e DDD incluído ex. (11) 94343-0808, retorne apenas os números do telefone ex. 11943430808. ```csharp= public string CalcularCelular (string numero) { string apenas = numero.Replace("(",""); apenas = apenas.Replace(")",""); apenas = apenas.Replace("-",""); apenas = apenas.Replace(" ",""); return apenas; } string n = CalcularCelular("(11)93546 - 8927"); // 11935468927 ``` ## Nível IV ### Exercício 1 Faça uma função ÚNICA que a partir de uma data, descubra o último dia do mês a partir dessa data. ```csharp= public DateTime CalcularUltimoDiaDoMes (DateTime data) { DateTime u = data.AddMonths(1); int d = data.Day; DateTime T = u.AddDays(-d); return T; } DateTime D = new DateTime(2019,05,04); DateTime d = CalcularUltimoDiaDoMes(D); // 5/31/2019 12:00:00 AM ``` ### Exercício 2 Faça uma função ÚNICA que a partir de uma data, descubra o primeiro dia do próximo mês a partir dessa data. ```csharp= public DateTime CalcularPrimeirodiaMes (DateTime data) { DateTime u = data.AddMonths(1); int d = data.Day; DateTime T = u.AddDays(-d); DateTime Primo = T.AddDays(1); return Primo; } DateTime D = new DateTime(2012,03,28); DateTime d = CalcularPrimeirodiaMes(D); // 4/1/2012 12:00:00 AM ``` ### Exercício 4 Faça uma função ÚNICA que a partir de uma data, retorne verdadeiro/falso se a pessoa tem mais de 18 anos a partir do dia atual. ```csharp= public bool UltimoDiaDoMes (DateTime dataatual, DateTime nascimento) { int data = dataatual.Year; int nasc = nascimento.Year; int maior = data - nasc; bool d = igual => 24; return d; } DateTime D = new DateTime(2000,03,14); DateTime N = new DateTime(2020,08,04); bool x = UltimoDiaDoMes(D, N); x // ``` ### Exercício 5 Faça uma função ÚNICA que a partir de uma data, retorne verdadeiro/falso se a data pertence a primeira quinzena do mês. ```csharp= public bool CalcularPrimeiraquinzenames (DateTime data) { int dia = data.Day; bool quinzena = dia >= 1 && dia <= 15; return quinzena; } DateTime D = new DateTime(2000,09,30); bool x = CalcularPrimeiraquinzenames (D); x // False ``` ## Nível V ### Exercício 1 Faça uma função COMPOSTA que a partir dos valores ‘a’, ‘b’ e 'c’, calcule o valor de 'x’ baseado na equação de segundo grau. ```csharp= public double Calcularumvalorx ( double a, double e, double i) { double a1 = Calcularpartida(a); double e1 = Calcularmeio(e); double i1 = Calcularfinal(i); double x = a1/2 + e1 - i1*2; return x; } public double Calcularpartida(double a) { double x = a*2; return x; } public double Calcularmeio(double e) { double x = e + 2.5; return x; } public double Calcularfinal(double i) { double x = i*5; return x; } double resultadofinal = Calcularumvalorx(8, 2, 4.5); // -32.5 ``` ### Exercício 2 Faça uma função COMPOSTA que encontre um termo de uma PA (Progressão Aritmética), a partir do primeiro termo, razão e posição do termo que deseja encontrar. ```csharp= public double CalcularProgressaoAritmedica(double n, double n1, double n2) { double deus = subtracao(n); double meajuda = multiplicacao(deus,n2); double An = n1 + meajuda; return An; } public double subtracao(double n) { double An = n - 1; return An; } public double multiplicacao(double deus, double n2) { double An = deus * n2; return An; } double x = CalcularProgressaoAritmedica( 15, 3, 5); // 73 ``` ### Exercício 3 Faça uma função COMPOSTA que encontre um termo de uma PG (Progressão Geométrica), a partir do primeiro termo, razão e posição do termo que deseja encontrar. ```csharp= public double CalcularProgressaoGeometrica(double n, double n1, double n2) { double help = sub(n); double me = pow(n2, help); double please = n1 * me; return me; } public double sub(double n) { double An = n - 1; return An; } public double pow(double n2, double help) { double An = Math.Pow(n2,help); return An; } double x = CalcularProgressaoGeometrica( 8, 2, 4); // 16384 ``` ### Exercício 3 Faça uma função COMPOSTA que a partir de dois nomes completos, verdadeiro/falso se as pessoas são da mesma família, comparando o último nome das duas pessoas. ```csharp= public bool CalcularSobrenomeigual (string nome1, string nome2) { string sobrenome1 = CalcularUltimonome(nome1); string sobrenome2 = CalcularUltimonome(nome2); bool iguais = sobrenome1 == sobrenome2; return iguais; } public string CalcularUltimonome (string nome1) { int primeironome = nome1.LastIndexOf(" "); int todas1 = nome1.Length; string sobrenome1 = nome1.Substring(primeironome,todas1-primeironome); string iguais = sobrenome1.Trim(); return iguais; } string nome1= "Jaden Smith"; string nome2 = "Will Smith"; bool x = CalcularSobrenomeigual(nome1,nome2); // True ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully