-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
117 lines (97 loc) · 4.06 KB
/
Copy pathProgram.cs
File metadata and controls
117 lines (97 loc) · 4.06 KB
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
using System;
namespace Demografia
{
class Program
{
static void Main(string[] args)
{
Apariencia();
while (2 > 1)
{
Calculos();
}
}
static void Apariencia()
{
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.WriteLine("----------------JatoMixo----------------");
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("--------Calculador de demografía--------");
Console.ForegroundColor = System.ConsoleColor.DarkBlue;
Console.WriteLine("----------------------------------------");
Console.Title = "JatoMixo: Calculador de exámenes";
Console.ForegroundColor = System.ConsoleColor.Green;
Console.WindowWidth = 40;
}
static void Calculos()
{
Console.ForegroundColor = System.ConsoleColor.DarkRed;
Console.WriteLine("-DATOS-");
Console.ForegroundColor = System.ConsoleColor.Green;
double habitantes = PedirDato("Habitantes: ");
double nacementos = PedirDato("Nacementos: ");
double defuncions = PedirDato("Defuncións: ");
double defuncionsnenos = PedirDato("Defuncións de nenos: ");
double emigrantes = PedirDato("Emigrantes: ");
double inmigrantes = PedirDato("Inmigrantes: ");
Console.ForegroundColor = System.ConsoleColor.DarkRed;
Console.WriteLine("-RESULTADOS-");
Console.ForegroundColor = System.ConsoleColor.Green;
double TN = TaxaNatalidade(nacementos, habitantes);
double TM = TaxaMortalidade(defuncions, habitantes);
double TMI = TaxaMortalidadeInfantil(defuncionsnenos, nacementos);
double CN = CrecementoNatural(nacementos, defuncions);
double TCN = TaxaCrecementoNatural(TN ,TM);
DarDato("Taxa de natalidade: ", TN);
DarDato("Taxa de mortalidade: ", TM);
DarDato("Taxa de mortalidade infantil: ", TMI);
DarDato("Crecemento natural: ", CN);
DarDato("Taxa de crecemento natural: ", TCN);
Console.ForegroundColor = System.ConsoleColor.DarkBlue;
Console.WriteLine("----------------------------------------");
Console.ForegroundColor = System.ConsoleColor.Green;
}
static void DarDato(string message, double dato)
{
Console.ForegroundColor = System.ConsoleColor.Green;
Console.Write(message);
Console.ForegroundColor = System.ConsoleColor.DarkMagenta;
Console.WriteLine(dato);
Console.ForegroundColor = System.ConsoleColor.Green;
}
static double PedirDato(string message)
{
Console.ForegroundColor = System.ConsoleColor.Green;
Console.Write(message);
Console.ForegroundColor = System.ConsoleColor.DarkMagenta;
double returned = Convert.ToDouble(Console.ReadLine());
Console.ForegroundColor = System.ConsoleColor.Green;
return returned;
}
static double TaxaMortalidade(double falecementos, double poboacion)
{
double returned = (falecementos / poboacion) * 1000;
return returned;
}
static double TaxaMortalidadeInfantil(double falecementos, double nacementos)
{
double returned = (falecementos / nacementos) * 1000;
return returned;
}
static double CrecementoNatural(double nacementos, double defuncions)
{
double returned = nacementos - defuncions;
return returned;
}
static double TaxaCrecementoNatural(double TN, double TM)
{
double returned = TN - TM;
return returned;
}
static double TaxaNatalidade(double nacementos, double habitantes)
{
double returned = (nacementos / habitantes) * 1000;
return returned;
}
}
}