Exemple #1
0
 public void wyswietlListe() {
   ArrayIt it = new ArrayIt(list);
   it.first();
   while (it.hasNext()) {
     Towar t = (Towar) it.current();
     System.out.printf("%-10s %-3d %5.2f %5.2f %n", t.towar, t.ilosc, t.cena, t.wartosc);
     it.next();
   }
   System.out.println();
 }
Exemple #2
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 #3
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;
 }