Exemple #1
0
 public void zmianaCeny(float Ncena, String nazwa) {
   ArrayIt it = new ArrayIt(list);
   it.first();
   while (it.hasNext()) {
     Towar t = (Towar) it.current();
     if (t.towar.equals(nazwa)) {
       t.cena = Ncena;
     }
     it.next();
   }
   System.out.println("Zmieniam cene " + nazwa + " na " + Ncena + "\n");
 }
Exemple #2
0
 public float wartosc() {
   ArrayIt it = new ArrayIt(list);
   it.first();
   float sumaWar = 0;
   while (it.hasNext()) {
     Towar t = (Towar) it.current();
     t.wartosc = (t.ilosc * t.cena);
     sumaWar += t.wartosc;
     it.next();
   }
   System.out.println("Wartosc wynosi " + sumaWar + "\n");
   return sumaWar;
 }
 @Override
 public int compare(Towar o1, Towar o2) {
   String naz1 = o1.getNazwa();
   String naz2 = o2.getNazwa();
   return naz1.compareToIgnoreCase(naz2);
 }