Package lesson02

Examples of lesson02.Vehicle


    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].setSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedList startNode = new LinkedList(vehicles[0]);
   
    LinkedList node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(new LinkedList(vehicles[i]));
      node = node.next;
    }
   
    node = startNode;
    while(node != null) {
      Vehicle output = (Vehicle)node.getValue();
      System.out.println("ID : " + output.getId());
      System.out.println("OWNER : " + output.getOwner());
      System.out.println("SPEED : " + output.getSpeed());
      System.out.println("DIRECTION : " + output.getDirection());
      System.out.println();
     
      node = node.next;
    }
   
View Full Code Here


    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].setSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedList startNode = new LinkedList(vehicles[0]);
   
    LinkedList node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(new LinkedList(vehicles[i]));
      node = node.next;
    }
   
    node = startNode;
    while(node != null) {
      Vehicle output = (Vehicle)node.getValue();
      System.out.println("ID : " + output.getId());
      System.out.println("OWNER : " + output.getOwner());
      System.out.println("SPEED : " + output.getSpeed());
      System.out.println("DIRECTION : " + output.getDirection());
      System.out.println();
     
      node = node.next;
    }
   
View Full Code Here

    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].setSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedList startNode = new LinkedList(vehicles[0]);
   
    LinkedList node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(new LinkedList(vehicles[i]));
      node = node.next;
    }
   
    node = startNode;
    while(node != null) {
      Vehicle output = (Vehicle)node.getValue();
      System.out.println("ID : " + output.getId());
      System.out.println("OWNER : " + output.getOwner());
      System.out.println("SPEED : " + output.getSpeed());
      System.out.println("DIRECTION : " + output.getDirection());
      System.out.println();
     
      node = node.next;
    }
   
View Full Code Here

    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].setSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedList startNode = new LinkedList(vehicles[0]);
   
    LinkedList node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(new LinkedList(vehicles[i]));
      node = node.next;
    }
   
    node = startNode;
    while(node != null) {
      Vehicle output = (Vehicle)node.getValue();
      System.out.println("ID : " + output.getId());
      System.out.println("OWNER : " + output.getOwner());
      System.out.println("SPEED : " + output.getSpeed());
      System.out.println("DIRECTION : " + output.getDirection());
      System.out.println();
     
      node = node.next;
    }
  }
View Full Code Here

    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].setSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedList startNode = new LinkedList(vehicles[0]);
   
    LinkedList node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(new LinkedList(vehicles[i]));
      node = node.next;
    }
   
    node = startNode;
    while(node != null) {
      Vehicle output = (Vehicle)node.getValue();
      System.out.println("ID : " + output.getId());
      System.out.println("OWNER : " + output.getOwner());
      System.out.println("SPEED : " + output.getSpeed());
      System.out.println("DIRECTION : " + output.getDirection());
      System.out.println();
     
      node = node.next;
    }
  }
View Full Code Here

TOP

Related Classes of lesson02.Vehicle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.