Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ScriptSCharp
- {
- class Program
- {
- static void Main(string[] args)
- {
- /* Exercício 54
- O cardápio de uma lanchonete é o seguinte:
- Código Especificação Preço unitário
- 100 Cachorro quente 4,50
- 101 Bauru simples 4,50
- 102 Bauru c/ovo 5,50
- 103 Hambúrguer 6,50
- 104 Refrigerante 3,50
- Escrever um algoritmo que leia o código do item pedido, a quantidade e calcule o valor
- a ser pago por aquele lanche.
- Considere que a cada execução somente será calculado um item. */
- try
- {
- Console.WriteLine("------------");
- Console.WriteLine(" Cardápio ");
- Console.WriteLine("------------");
- Console.WriteLine("| 100 |Cachorro quente |R$:4,50 |");
- Console.WriteLine("| 101 |Bauru simples |R$:4,50 |");
- Console.WriteLine("| 102 |Bauru c / ovo |R$:5,50 |");
- Console.WriteLine("| 103 |Hambúrguer |R$:6,50 |");
- Console.WriteLine("| 104 |Refrigerante |R$:3,50 |\n");
- Console.Write("Digite o código: ");
- string cod = Console.ReadLine().ToLower();
- Console.Write("Digite a quantidade: ");
- int quan = int.Parse(Console.ReadLine());
- quan.ToString("F2");
- switch (cod)
- {
- case "100":
- Console.WriteLine(" Cachorro quente: " + (quan * 4.50));
- break;
- case "101":
- Console.WriteLine("Bauru simples: " + (quan * 4.50));
- break;
- case "102":
- Console.WriteLine("Bauru c/ovo: " + (quan * 5.50));
- break;
- case "103":
- Console.WriteLine("Hambúrguer: " + (quan * 6.50));
- break;
- case "104":
- Console.WriteLine("Refrigerante: " + (quan * 3.50));
- break;
- default:
- Console.WriteLine("Código não encontrado!");
- break;
- }
- }
- catch (System.Exception)
- {
- Console.WriteLine("Ocorreu um ERRO, tente novamente mais tarde!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement