Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cl.adl.collec;
- import java.util.ArrayList;
- import java.util.ListIterator;
- public class EjemploCollec {
- public static void main(String[] args) {
- ArrayList<Float> notas = new ArrayList<>();
- notas.add(5.7f);
- notas.add(3.5f);
- notas.add(7f);
- notas.add(5.5f);
- notas.add(6.4f);
- System.out.println(notas);
- float suma = 0;
- float menor = notas.get(0);
- for (Float s: notas) {
- if(s<menor) {
- menor = s;
- }else {
- suma = suma + s;
- }
- }
- notas.remove(menor);
- float promedio = suma/notas.size();
- System.out.println(notas);
- System.out.println(promedio);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement