Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package Media;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11.  
  12. /**
  13. *
  14. * @author DavidDager
  15. */
  16. public class Media {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. * @throws java.io.IOException
  21. */
  22. public static void main(String[] args) throws IOException {
  23. BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
  24. double contador = 1, total = 0, media;
  25. String nota;
  26.  
  27. for (int i = 0; i < 5; i++) {
  28. System.out.println("\nTeclee calificación (A,B,C,D,E): ");
  29. nota = entrada.readLine();
  30. nota = nota.toUpperCase();
  31.  
  32. switch(nota) {
  33. case "A":
  34. total += 4;
  35. break;
  36. case "B":
  37. total += 3;
  38. break;
  39. case "C":
  40. total += 2;
  41. break;
  42. case "D":
  43. total += 1;
  44. break;
  45. case "E":
  46. total += 0;
  47. break;
  48. }
  49.  
  50. }
  51.  
  52. contador += 1;
  53. media = total / 5;
  54. System.out.println ("\n\nEl promedio del grupo es: " + media);
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement