Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Interface {
- public Interface()
- {
- }
- public Aluno pegueAluno()
- {
- String nome = JOptionPane.showInputDialog("Digite o nome: ");
- String p1 = JOptionPane.showInputDialog("Digite a nota 1: ");
- double nota1 = Double.parseDouble(p1);
- String p2 = JOptionPane.showInputDialog("Digite a nota 2: ");
- double nota2 = Double.parseDouble(p2);
- String p3 = JOptionPane.showInputDialog("Digite a nota 3: ");
- double nota3 = Double.parseDouble(p3);
- Aluno a = new Aluno(nome, nota1, nota2, nota3);
- return a;
- }
- public void mostreResultados(String nome, double nota1, double nota2, double nota3, double media, String resultado, double max )
- {
- JOptionPane.showMessageDialog(null,"Nome = "+nome+"\nNota 1 = "+nota1+"\nNota 2 = "+nota2+"\nNota 3 = "+nota3+"\nMedia = "+media+"\nMaior nota = "+max+"\n"+resultado);
- }
- public int pecaQuantAlunos()
- {
- String quantAlunos = JOptionPane.showInputDialog("Digite quantidade de alunos");
- int qtAlunos = Integer.parseInt(quantAlunos);
- return qtAlunos;
- }
- public void mostreMensagens(int qtAprovados, int qtNotaMenor4)
- {
- JOptionPane.showMessageDialog(null, "Quantidade de alunos aprovados: "+qtAprovados+"\nQuantidade de alunos com média menor que 4: "+qtNotaMenor4);
- }
- public void mostreMelhor(Aluno melhor)
- {
- JOptionPane.showMessageDialog(null, "Melhor aluno é : "+melhor.informeNome()+ "\n Media : " + melhor.fornecaMedia() );
- }
- public char pergunteSeTemMais()
- {
- String resposta = JOptionPane.showInputDialog ("Tem outro? (S/N)");
- char r = resposta.charAt(0);
- return r;
- }
- }
Add Comment
Please, Sign In to add comment