Advertisement
Guest User

Untitled

a guest
Jan 31st, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.util.List;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. List<Auto> listAut= new Linkedlist<Auto>(); // linkedlist ze wzgledu na ciagle modyfikajce
  9.  
  10.  
  11.  
  12. Scanner scanner = new Scanner(System.in);
  13. Auto car = new Auto(); // obiekt "car" o typie obiektowym Auto
  14. Komis sK = new Komis("KomiexCars", 200000); // komis komiexcars i stan konta 2000000
  15.  
  16.  
  17.  
  18. System.out.println("Co chcesz zrobić:" );
  19. System.out.println("1. Metoda dodaj" );
  20. System.out.println(" 2. Metoda usun" );
  21. int a = scanner.nextInt();
  22.  
  23. switch(a) {
  24. case 1: {
  25. car.setMarka(scanner.nextLine());
  26. car.setModel(scanner.nextLine());
  27. car.setCena(scanner.nextDouble());
  28. listAut.add(car);
  29. }
  30. break;
  31.  
  32. case 2:{
  33. listAut.remove(car); // wstepny do usuwnia
  34.  
  35. }
  36.  
  37.  
  38.  
  39.  
  40. }
  41.  
  42.  
  43.  
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement