-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAula15.cs
42 lines (31 loc) · 900 Bytes
/
Aula15.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//SWITCH uso dele na programação
using System;
class Aula15{
static void Main(){
int tempo=0;
char escolha;
Console.WriteLine("Belo Horizonete/MG a Vitória/ES");
Console.WriteLine("Escolha um transporte: [a}Avião | [c]Carro | [o]ônibus");
escolha = char.Parse(Console.ReadLine());
switch(escolha){
case'a':
tempo = 50;
break;
case'c':
tempo = 450;
break;
case'o':
tempo=660;
break;
default:
tempo=-1;
break;
}
if (tempo < 0)
{
Console.WriteLine("Transporte indisponível");
}
else
{ Console.WriteLine("Para o transporte escolhido o tempo é: {0}minutos", tempo); }
}
}