generated from leamsi07/programacion1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
134 lines (105 loc) · 3.98 KB
/
Program.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace metodos
{
class Program
{
static void Main(string[] args)
{
Program n = new Program();
bool seguir = true;
string entrada = "";
while (seguir)
{
Console.Clear();
Console.WriteLine("Bienvenidos a el listado de empleados de la empresa ");
Console.WriteLine("Elija la opcion que desee: ");
Console.WriteLine("1 metodo llamado HolaEstudiante");
Console.WriteLine("2 Metodo que recorra los numeros del 1-50 ");
Console.WriteLine("3 Metodo con un programa que genere un número al azar entre 1 y 100");
Console.WriteLine("4 Clase vehiculo");
Console.WriteLine("5 Clase producto");
Console.WriteLine("6 Salir");
entrada = Console.ReadLine();
switch (entrada)
{
case "1":
Console.Clear();
n.HolaEstudiante();
break;
case "2":
Console.Clear();
n.Numeros();
break;
case "3":
Console.Clear();
n.Random();
break;
case "4":
Console.Clear();
Vehiculo v = new Vehiculo();
v.Atributos();
v.EstadoOn();
break;
case "5":
Console.Clear();
producto p = new producto();
p.ProductoDisponible();
break;
case "6":
Console.WriteLine("Adios :(");
Console.ReadLine();
seguir = false;
break;
default:
Console.WriteLine("Algo anda mal :( elija la opcion correcta :)");
Console.ReadLine();
break;
}
}
}
public void HolaEstudiante()
{
Console.WriteLine("Hola, estudiante Larrisa Manoela. Bienvenido a programación I ");
}
public void Numeros()
{
Console.WriteLine("Numeros del 1 al 50");
Console.ReadLine();
for (int i =1; i<51; i++)
{
Console.WriteLine(i);
}
}
public void Random()
{
const int oportunidades = 6;
byte i, adivinado;
Random k = new Random();
int aleatorio= k.Next(1, 100);
i = 1; adivinado = 0;
do
{
Console.WriteLine("Intenta acertar el numero Random");
int valor = int.Parse(Console.ReadLine());
if (aleatorio == valor)
{
Console.WriteLine("Acertaste correctamente el numero es ", aleatorio);
}
else
{
Console.WriteLine("Siga intentando esta cerca");
}
i++;
} while (((i <= oportunidades) & (adivinado == 0)));
if ((adivinado == 0))
{
Console.Write("Has agotado los intentos... El numero fue: " + aleatorio);
}
Console.ReadKey();
}
}
}