Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. /*
  2. 27) Crie um programa que leia duas notas de um aluno e calcule a sua média,
  3. mostrando uma mensagem no final, de acordo com a média atingida:
  4. - Média até 4.9: REPROVADO
  5. - Média entre 5.0 e 6.9: RECUPERAÇÃO
  6. - Média 7.0 ou superior: APROVADO
  7. */
  8. package pkg027;
  9.  
  10. import java.util.Scanner ;
  11.  
  12. public class Main {
  13.  
  14.  
  15. public static void main(String[] args) {
  16.  
  17. Scanner teclado = new Scanner (System.in) ;
  18.  
  19. float nota1 , nota2 , result ;
  20.  
  21. System.out.print("Digite a primeira nota : ");
  22. nota1 = teclado.nextFloat() ;
  23.  
  24. System.out.print("Digite a segunda nota : ");
  25. nota2 = teclado.nextInt() ;
  26.  
  27. result = (nota1 + nota2) / 2 ;
  28.  
  29. if (result <= 4.9) {
  30.  
  31. System.out.print("O aluno ficou com a media de " + result + "e está REPROVADO ");
  32.  
  33. }else if (result > 5.0 && result < 6.9){
  34.  
  35. System.out.print("O aluno ficou com a media de " + result + "e está de RECUPERAÇÂO") ;
  36.  
  37. }else{
  38.  
  39. System.out.print("O aluno ficou com a media de " +result + "e está APROVADO" );
  40.  
  41.  
  42. }
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement