Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. package lesson1.part_2.frame_13;
  2.  
  3. /**
  4. * Created by otroshenko on 11.02.2016.
  5. */
  6. public class Launcher {
  7.  
  8. static Tank[] tank = new Tank[5];
  9.  
  10. public static void main(String[] args) {
  11. fillTankInfo();
  12. printTankInfo();
  13. }
  14.  
  15. private static void fillTankInfo() {
  16.  
  17. //fill with konstructor
  18. tank[0] = new Tank("T-84 BM Oplot", "gray", 3, 70);
  19. tank[1] = new Tank("Leopard 2A7", "brown", 4, 72);
  20.  
  21. //fill with set
  22. tank[2] = new Tank();
  23. tank[2].setModel("Merkava Mk-6");
  24. tank[2].setColor("dark brown");
  25. tank[2].setCrew(3);
  26. tank[2].setMaxSpeed(90);
  27. }
  28.  
  29. private static void printTankInfo() {
  30. for (Tank tt : tank) {
  31. if (tt != null) {
  32. System.out.print("Model: " + tt.getModel() + ", color: " + tt.getColor() + ", ");
  33. System.out.print("crew: " + tt.getCrew() + ", maxSpeed: " + tt.getMaxSpeed());
  34. System.out.println();
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement