* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package programame1;
import java.util.Scanner;
/**
*
* @author Santi
*/
public class UVA11777_AutomatizarGrados {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int cant;
int num1, num2, num3, num4, num5, num6, num7;
cant = entrada.nextInt();
for (int i = 1; i <= cant; i++) {
num1 = entrada.nextInt();
num2 = entrada.nextInt();
num3 = entrada.nextInt();
num4 = entrada.nextInt();
num5 = entrada.nextInt();
num6 = entrada.nextInt();
num7 = entrada.nextInt();
mostrarNota(i, calculaNota(num1, num2, num3, num4, num5, num6, num7));
}
}
static int calculaNota(int num1, int num2, int num3, int num4, int num5, int num6, int num7) {
int nota;
int media = 0;
nota = num1 + num2 + num3 + num4;
if (num5 >= num6 || num5 >= num7) {
media += num5;
}
if (num6 >= num5 || num6 >= num7) {
media += num6;
}
if (num7 > num5 || num7 > num6) {
media += num7;
}
nota += media / 2;
return nota;
}
static void mostrarNota(int caso, int nota) {
char calificacion;
if (nota >= 90) {
calificacion = 'A';
} else if (nota >= 80) {
calificacion = 'B';
} else if (nota >= 70) {
calificacion = 'C';
} else if (nota >= 60) {
calificacion = 'D';
} else {
calificacion = 'F';
}
System.out.println("Case " + caso + ": " + calificacion);
}
}
No hay comentarios:
Publicar un comentario