Advertisement
AnandaVieira

Exercicio 54

May 10th, 2021 (edited)
1,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ScriptSCharp
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             /* Exercício 54
  11.             O cardápio de uma lanchonete é o seguinte:
  12.             Código Especificação Preço unitário
  13.             100 Cachorro quente 4,50
  14.             101 Bauru simples 4,50
  15.             102 Bauru c/ovo 5,50
  16.             103 Hambúrguer 6,50
  17.             104 Refrigerante 3,50
  18.             Escrever um algoritmo que leia o código do item pedido, a quantidade e calcule o valor
  19.             a ser pago por aquele lanche.
  20.             Considere que a cada execução somente será calculado um item. */
  21.  
  22.             try
  23.             {
  24.  
  25.                 Console.WriteLine("------------");
  26.                 Console.WriteLine("  Cardápio  ");
  27.                 Console.WriteLine("------------");
  28.  
  29.                 Console.WriteLine("| 100 |Cachorro quente |R$:4,50 |");
  30.                 Console.WriteLine("| 101 |Bauru simples |R$:4,50 |");
  31.                 Console.WriteLine("| 102 |Bauru c / ovo |R$:5,50 |");
  32.                 Console.WriteLine("| 103 |Hambúrguer |R$:6,50 |");
  33.                 Console.WriteLine("| 104 |Refrigerante |R$:3,50 |\n");
  34.  
  35.                 Console.Write("Digite o código: ");
  36.                 string cod = Console.ReadLine().ToLower();
  37.  
  38.                 Console.Write("Digite a quantidade: ");
  39.                 int quan = int.Parse(Console.ReadLine());
  40.                 quan.ToString("F2");
  41.  
  42.                 switch (cod)
  43.                 {
  44.                     case "100":
  45.                         Console.WriteLine(" Cachorro quente: " + (quan * 4.50));
  46.                         break;
  47.                     case "101":
  48.                         Console.WriteLine("Bauru simples: " + (quan * 4.50));
  49.                         break;
  50.                     case "102":
  51.                         Console.WriteLine("Bauru c/ovo: " + (quan * 5.50));
  52.                         break;
  53.                     case "103":
  54.                         Console.WriteLine("Hambúrguer: " + (quan * 6.50));
  55.                         break;
  56.                     case "104":
  57.                         Console.WriteLine("Refrigerante: " + (quan * 3.50));
  58.                         break;
  59.                     default:
  60.                         Console.WriteLine("Código não encontrado!");
  61.                         break;
  62.                 }
  63.  
  64.             }
  65.             catch (System.Exception)
  66.             {
  67.                 Console.WriteLine("Ocorreu um ERRO, tente novamente mais tarde!");
  68.             }
  69.  
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement