Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exercicio;
- import static java.sql.Types.NULL;
- import java.util.ArrayList;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class Exercicio9 {
- static ArrayList<EXE9> alunos = new ArrayList<>();
- static Scanner leia = new Scanner(System.in);
- public static void main(String[] args) {
- // EXE9 ftp = new EXE9();
- String nomeMaior = "";
- String nomeMenor = "";
- float maior = 0;
- float menor = 10;
- int val = 0;
- int x = 0;
- //menor = ftp.getNota();
- while (val < 3) {
- //System.out.print("Nome............: "+ menor);
- JOptionPane.showMessageDialog(null, "Incluir novo Aluno" );
- String Nome = JOptionPane.showInputDialog("Nome.........: ");
- String nome = (Nome);
- String Nota = JOptionPane.showInputDialog("Nota..........: ");
- float nota = Float.parseFloat(Nota);
- String con = JOptionPane.showInputDialog("Confirma a inclusão do Aluno? :");
- String conf = (con);
- if (conf.equals("S") || conf.equals("s")||conf.equals("") ) {
- EXE9 Alunos = new EXE9(nome, nota);
- Exercicio9.alunos.add(Alunos);
- val++;
- }
- }
- for (int i = 0;i <= (val+1);i++){
- for (EXE9 sor : alunos) {
- if ((sor.getNota()) > (maior)) {
- nomeMaior = (sor.getNome());
- maior = (sor.getNota());
- } else if ((sor.getNota()) < (menor)){
- nomeMenor = (sor.getNome());
- menor = (sor.getNota());
- }
- }
- JOptionPane.showMessageDialog(null, i +"Nome......: " + nomeMenor + " Menor Nota......: " + menor + "\nNome......: " + nomeMaior + " Maior Nota.....: " + maior);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement