Guest User

Untitled

a guest
Nov 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class Interface {
  3.  
  4. public Interface()
  5.     {
  6.     }
  7.     public Aluno pegueAluno()
  8.     {
  9.         String nome = JOptionPane.showInputDialog("Digite o nome: ");
  10.        
  11.         String p1 = JOptionPane.showInputDialog("Digite a nota 1: ");
  12.         double nota1 = Double.parseDouble(p1);
  13.        
  14.         String p2 = JOptionPane.showInputDialog("Digite a nota 2: ");
  15.         double nota2 = Double.parseDouble(p2);
  16.        
  17.         String p3 = JOptionPane.showInputDialog("Digite a nota 3: ");
  18.         double nota3 = Double.parseDouble(p3);
  19.    
  20.         Aluno a = new Aluno(nome, nota1, nota2, nota3);
  21.        
  22.         return a;
  23.     }
  24.     public void mostreResultados(String nome, double nota1, double nota2, double nota3, double media, String resultado, double max )
  25.     {
  26.         JOptionPane.showMessageDialog(null,"Nome = "+nome+"\nNota 1 = "+nota1+"\nNota 2 = "+nota2+"\nNota 3 = "+nota3+"\nMedia = "+media+"\nMaior nota = "+max+"\n"+resultado);
  27.     }
  28.    
  29.     public int pecaQuantAlunos()
  30.     {
  31.         String quantAlunos = JOptionPane.showInputDialog("Digite quantidade de alunos");
  32.         int qtAlunos = Integer.parseInt(quantAlunos);
  33.    
  34.         return qtAlunos;
  35.     }
  36.    
  37.     public void mostreMensagens(int qtAprovados, int qtNotaMenor4)
  38.     {
  39.         JOptionPane.showMessageDialog(null, "Quantidade de alunos aprovados: "+qtAprovados+"\nQuantidade de alunos com média menor que 4: "+qtNotaMenor4);
  40.     }
  41.     public void mostreMelhor(Aluno melhor)
  42.     {
  43.         JOptionPane.showMessageDialog(null, "Melhor aluno é : "+melhor.informeNome()+ "\n Media : " + melhor.fornecaMedia() );
  44.     }
  45.     public char pergunteSeTemMais()
  46.     {
  47.     String resposta = JOptionPane.showInputDialog ("Tem outro? (S/N)");
  48.    
  49.     char r = resposta.charAt(0);
  50.     return r;
  51.     }
  52. }
Add Comment
Please, Sign In to add comment