Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 Media;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- /**
- *
- * @author DavidDager
- */
- public class Media {
- /**
- * @param args the command line arguments
- * @throws java.io.IOException
- */
- public static void main(String[] args) throws IOException {
- BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
- double contador = 1, total = 0, media;
- String nota;
- for (int i = 0; i < 5; i++) {
- System.out.println("\nTeclee calificación (A,B,C,D,E): ");
- nota = entrada.readLine();
- nota = nota.toUpperCase();
- switch(nota) {
- case "A":
- total += 4;
- break;
- case "B":
- total += 3;
- break;
- case "C":
- total += 2;
- break;
- case "D":
- total += 1;
- break;
- case "E":
- total += 0;
- break;
- }
- }
- contador += 1;
- media = total / 5;
- System.out.println ("\n\nEl promedio del grupo es: " + media);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement