CSIT115 Project p3 Coding with ArrayList<ITSystem>

                                                                                                NAME:__________________________________

For p3, we need the following field in SysInventory.java:

private ArrayList<ITSystem> systems;

1.       Write one line of code to add a new ITSystem object named newSys to systems.

 

2.       Write one line of code to make the variable “first”, of type ITSystem, reference the very first ITSystem in systems.

 

 

3.       Write code to loop over the systems and count the number of systems in room 100. Leave the count in int variable “count” which you have defined here.

 

 

 

 

 

4.       Suppose you have put the following helper function (from p3.html) in your SysInventory.java file:

private ITSystem findSystem(int id) {

    return systems.get(systems.indexOf(new ITSystem(id, 0, 0)));

}

 

Give a line of code to call findSystem to locate the system with id 101 and assign it to a new variable named oldSys.