Console.WriteLine("INICIO DA JORNADA DO HERÓI!");
var mediaAlunos = new Dictionary<string, Dictionary<string, List<int>>>
{
{
"Ana", new Dictionary<string, List<int>>
{
{"C#", new List<int> {8,7,6} },
{"Java", new List<int> {7,6,5 }},
{"Python", new List<int> {9,8,8 }}
} },
{
"Maria", new Dictionary<string, List<int>>
{
{"C#", new List<int> {6,5,4 }},
{"Java", new List<int> {8,7,6 } },
{"Python", new List<int> {6,10,5} },
}},
{
"Luiza", new Dictionary<string, List<int>>
{
{"C#", new List<int> { 2,3,10} },
{"Java", new List<int> {8,8,8 } },
{"Python", new List<int> {7,7,7 } },
}},
}
;
double CalcularMedia(string aluno, string disciplina)
{
if (!mediaAlunos.ContainsKey(aluno))
{
Console.WriteLine("Aluno não encontrado");
return 0;
}
if (!mediaAlunos[aluno].ContainsKey(disciplina))
{
Console.WriteLine("Disciplina não encontrada");
return 0;
}
List<int> notas = mediaAlunos[aluno][disciplina];
double media = notas.Average();
return media;
}
void MostrarMedia()
{
foreach (var aluno in mediaAlunos)
{
Console.WriteLine($"Aluno: {aluno.Key}");
foreach (var disciplina in aluno.Value)
{
double media = disciplina.Value.Average();
Console.WriteLine($" {disciplina.Key}: {media:F2}");
}
}
}
MostrarMedia();