public static void peržiūrėtiSąrašą() { int sk = 0; for (Automobilis a = bandomieji.get(1); a != null; a = bandomieji.getNext()) { if (a.getMarkė().compareTo("Renault") == 0) sk++; } Ks.oun("Renault automobilių yra = " + sk); }
public static void checkList(String typeSearch) { int sk = 0; for (Place p = test.get(1); p != null; p = test.getNext()) { if (p.getType().compareTo(typeSearch) == 0) sk++; } Ks.oun(typeSearch + " tipo vietu yra = " + sk); }
public static void formuotiAutoSąrašą() { Automobilis a1 = new Automobilis("Renault", "Laguna", 1997, 50000, 1700); Automobilis a2 = new Automobilis("Renault", "Megane", 2001, 20000, 3500); Automobilis a3 = new Automobilis("Toyota", "Corolla", 2001, 20000, 8500.8); bandomieji.add(a1); bandomieji.add(a2); bandomieji.add(a3); bandomieji.println("Pirmi 3 auto"); bandomieji.add("Renault Laguna 2001 115900 7500"); bandomieji.add("Renault Megane 1946 365100 9500"); bandomieji.add("Honda Civic 2007 36400 8500.3"); bandomieji.println("Visi 6 auto"); Ks.oun( "Pirmų 3 auto ridos vidurkis= " + (bandomieji.get(0).getRida() + bandomieji.get(1).getRida() + bandomieji.get(2).getRida()) / 3); Ks.oun( "Kitų 3 auto kainų suma= " + (bandomieji.get(3).getKaina() + bandomieji.get(4).getKaina() + bandomieji.get(5).getKaina())); // bandomieji.add(0, new Automobilis("Mazda","6",2007,50000,27000)); // bandomieji.add(6, new Automobilis("Hyundai","Lantra",1998,9500,777)); // bandomieji.set(4, a3); // bandomieji.println("Po įterpimų"); // bandomieji.remove(7); // bandomieji.remove(0); // bandomieji.println("Po išmetimų"); // bandomieji.remove(0); bandomieji.remove(0); bandomieji.remove(0); // bandomieji.remove(0); bandomieji.remove(0); bandomieji.remove(0); // bandomieji.println("Po visų išmetimų"); // bandomieji.remove(0); // bandomieji.println("Po visų išmetimų"); }
public static void formPlaceList() { Place p1 = new Place("KTU Statybos rumai", 54.90596, 23.956235, 5, "akadem"); Place p2 = new Place("KTU SC", 54.904923, 23.957029, 8, "akadem"); Place p3 = new Place("KTU Elektronikos rumai", 54.903964, 23.958064, 10, "akadem"); test.add(p1); test.add(p2); test.add(p3); test.println("3 pirmos vietos"); test.add("KTU Dizaino fukultetas, 54.901068, 23.960451, 6, akadem"); test.add("KTU centriniai rūmai, 54.898986, 23.91284, 7, akadem"); test.add("PC Akropolis, 54.891582, 23.919145, 6, pc"); test.println("Visos 6-ioss vietos"); Ks.oun( "Pirmų 3 vietu atstumu vidurkis= " + (test.get(0).getDistance() + test.get(1).getDistance() + test.get(2).getDistance()) / 3); Ks.oun( "Kitų 3 vietu intensyvymo suma= " + (test.get(3).getSparks()) + test.get(4).getSparks() + test.get(5).getSparks()); }
public static void tikrintiAtskirusAuto() { Automobilis a1 = new Automobilis("Renault", "Laguna", 1997, 50000, 1700); Automobilis a2 = new Automobilis("Renault", "Megane", 2001, 20000, 3500); Automobilis a3 = new Automobilis("Toyota", "Corolla", 2001, 20000, 8500.8); Automobilis a4 = new Automobilis("Renault Laguna 2001 115900 7500"); Automobilis a5 = new Automobilis("Renault Megane 1946 365100 9500"); Automobilis a6 = new Automobilis("Honda Civic 2007 36400 8500.3"); Ks.oun(a1); Ks.oun(a2); Ks.oun(a3); Ks.oun("Pirmų 3 auto ridos vidurkis= " + (a1.getRida() + a2.getRida() + a3.getRida()) / 3); Ks.oun(a4); Ks.oun(a5); Ks.oun(a6); Ks.oun("Kitų 3 auto kainų suma= " + (a4.getKaina() + a5.getKaina() + a6.getKaina())); }
public static void checkSorting() { PlaceList bList = new PlaceList(); bList.allPlaces.load("ban.txt"); Ks.oun("========" + bList.allPlaces.get(0)); bList.allPlaces.println("Bandomasis rinkinys"); bList.allPlaces.sort(Place.usingDistance); bList.allPlaces.println("Rūšiavimas pagal nuotoli nuo mano namu"); bList.allPlaces.sort(Place.usingSparks); bList.allPlaces.println("Rūšiavimas pagal intencyvuma"); bList.allPlaces.sort(Place.usingTypeAndName); bList.allPlaces.println("Rūšiavimas pagal tipa ir pavadinima"); bList.allPlaces.sort(listBySuggestionRating); bList.allPlaces.println("Rūšiavimas pagal siulymotikimybe"); bList.allPlaces.sort(); bList.allPlaces.println("Rūšiavimas pagal compareTo - Intencyvumas"); }
public static void checkSeparatePlaces() { Place p1 = new Place("KTU Statybos rumai", 54.90596, 23.956235, 5, "akadem"); Place p2 = new Place("KTU SC", 54.904923, 23.957029, 8, "akadem"); Place p3 = new Place("KTU Elektronikos rumai", 54.903964, 23.958064, 10, "akadem"); Place p4 = new Place("KTU Dizaino fukultetas", 54.901068, 23.960451, 6, "akadem"); Place p5 = new Place("KTU centriniai rūmai", 54.898986, 23.91284, 7, "akadem"); Place p6 = new Place("PC Akropolis", 54.891582, 23.919145, 6, "pc"); Place p7 = new Place("Žalgerio arena", 54.890308, 23.914456, 8, "arena"); Place p8 = new Place("Kauno sporto halė", 54.896111, 23.935833, 7, "arena"); Place p9 = new Place("PC Savas", 54.92258, 23.963379, 6, "pc"); Place p10 = new Place("PC Dainava", 54.917736, 23.96677, 4, "pc"); Ks.oun(p1); Ks.oun(p2); Ks.oun(p3); Ks.oun( "Pirmų 3 vietu atstumu vidurkis= " + ((p1.getDistance() + p2.getDistance() + p3.getDistance()) / 3)); Ks.oun(p4); Ks.oun(p5); Ks.oun(p6); Ks.oun("Kitų 3 vietu intensyvymo suma= " + (p4.getSparks() + p5.getSparks() + p6.getSparks())); }