Search:

Type: Posts; User: starm1x

Search: Search took 0.19 seconds.

  1. Replies
    7
    Views
    922

    Re: Find the nearest free iterator

    so i did in this way but i think it can be done better!!
    [
  2. Replies
    7
    Views
    922

    Re: Find the nearest free iterator

    so I need to run through the list and find which is free. Does not



    public class AmbulanceControl
    {
    private ArrayList<Ambulance> cars;

    public AmbulanceControl()
    {
  3. Replies
    7
    Views
    922

    Re: Find the nearest free iterator

    So how I can check if it is free?
  4. Replies
    7
    Views
    922

    Find the nearest free iterator

    So I am not sure if I am doing it correctly. I need to iterate through the list of an ambulance and then check if it is free. Then work out the distance of each area and return which is the nearest!...
  5. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    it works. Thank you


    public int getNumberOfAmbulances(int area)
    {
    int index = 0;
    for(Ambulance ab : cars){
    if(ab.getArea() == area){
    index++;...
  6. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    Hi. I manage to solve some of the problems.


    public int getNumberOfAmbulances(int area)
    {
    int index;
    for(Ambulance ab : cars){
    if(ab.getID() == area){
    ...
  7. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    yea you are right.
  8. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    Do i need to use else to return?

    --- Update ---

    So i can check that all cars has been checked?
  9. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    i know that it must increment so many like this


    if(ab.getID() == area){
    area++;
    return area;
    }


    --- Update ---
  10. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    so i return the area:


    if(ab.getID() == area){
    return area;
    }
  11. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    than i am doing this: what should i return?


    if(ab.getID() == area){

    }
  12. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    I do not know-how. I am stuck where I should create a for each loop i just can not creat one.
  13. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    it is everything what I got. The code must be in the getNumberOfAmbulance.




    private ArrayList<Ambulance> cars;

    public AmbulanceControl()
    {
    cars = new...
  14. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    it suppose to return the number of an ambulance in that area
  15. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    So I got ArraList ambulance. When the user will type area for example 1. it must return the number of the ambulances in that area.

    but i am doing something wrong. because when i am trying to...
  16. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    I am trying too much and then return but I just can not it just does not work. I just can not understand it.


    public int getNumberOfAmbulances(int area)
    {
    for(Ambulance ab : cars){...
  17. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    Yes, there is.
  18. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    I did not write this method. There is no

    --- Update ---

    I think I fix it and now it is works


    public void setStatus(int id, int area, boolean free)
    {
    Iterator<Ambulance> ab...
  19. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    So I have this special test condition for that "setStatus" and sometimes it works but in some condition, it does not work. And when it does not work it shows this ' assertEquals(!oldStatus,...
  20. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    So I wrote this, and it works.


    public void setStatus(int id, int area, boolean free)
    {
    Iterator<Ambulance> ab = cars.iterator();
    while(ab.hasNext()){
    ...
  21. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Re: Set the status

    I fix it! i got the errors where i am trying to set whether is free or not free

    area.moveTo();
    free.setBusy();
  22. Thread: Set the status

    by starm1x
    Replies
    34
    Views
    1,331

    Set the status

    So I wrote this code but I got two errors message "int can not be dereferenced" and "boolean can not be dereferenced"
    Can somebody help please?


    * Set the status of the ambulance whose ID...
Results 1 to 22 of 22