Results 1 to 3 of 3
Thread: Convert arrays into lists
- 12-28-2009, 08:39 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 2
- Rep Power
- 0
Convert arrays into lists
At the moment im trying to create a programme that creates a list of rooms and i need to list the rooms. Also i think i need a static method to list all the rooms i have created outside of the class/constructor.
I need to find a way either within this constructor or somewhere else to list all three arrays.Java Code://the constructor sets the Building name and the number of arrays it holds (3 arrays) //from its parameter list public BuildingV02(String name, int number_of_Lecture_rooms, int number_of_Practical_rooms, int number_of_Tutorial_rooms) { building_name = Console.readString("Enter the building name:"); Lecture_count = Console.readInt("Enter the number of Lecture rooms that the building will have:"); Practical_count = Console.readInt("Enter the number of Practical rooms that the building will have:"); Tutorial_count = Console.readInt("Enter the number of Tutorial rooms that the building will have:"); System.out.println("The rooms are created in order of type, the Lecture rooms will " + "be defined first followed by the Practical rooms and finally the Tutorial rooms"); //create the Lecture room objects in an array for (int j = 0; j < Lecture_count; j++) { Lecture_rooms = new Lecture[Lecture_count]; Lecture_rooms[j] = new Lecture("number not set", 0, false, false, false, false ,false ,false); } //create the Practical room objects for (int j = 0; j < Practical_count; j++) { Practical_rooms = new Practical[Practical_count]; Practical_rooms[j] = new Practical("number not set", 0, false, false, false, false ,false ,false); } //create the Tutorial room objects for (int j = 0; j < Tutorial_count; j++) { Tutorial_rooms = new Tutorial[Tutorial_count]; Tutorial_rooms[j] = new Tutorial("number not set", 0, false, false, false, false ,false ,false); } }
Apologies for any breach of etiquette this is my first post.
Thanks for any help you can giveLast edited by Richard2732; 12-28-2009 at 08:49 AM.
- 12-28-2009, 08:43 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
- 12-28-2009, 08:53 AM #3
Member
- Join Date
- Dec 2009
- Posts
- 2
- Rep Power
- 0
I think that was left from an older version which was going to use them, i have removed them, thanks :).
Java Code://the constructor sets the Building name and the number of arrays it holds (3 arrays) //from its parameter list public BuildingV02(String building_name) { building_name = Console.readString("Enter the building name:"); Lecture_count = Console.readInt("Enter the number of Lecture rooms that the building will have:"); Practical_count = Console.readInt("Enter the number of Practical rooms that the building will have:"); Tutorial_count = Console.readInt("Enter the number of Tutorial rooms that the building will have:"); System.out.println("The rooms are created in order of type, the Lecture rooms will " + "be defined first, followed by the Practical rooms, and finally the Tutorial rooms"); //create the Lecture room objects in an array for (int j = 0; j < Lecture_count; j++) { Lecture_rooms = new Lecture[Lecture_count]; Lecture_rooms[j] = new Lecture("number not set", 0, false, false, false, false ,false ,false); } //create the Practical room objects for (int j = 0; j < Practical_count; j++) { Practical_rooms = new Practical[Practical_count]; Practical_rooms[j] = new Practical("number not set", 0, false, false, false, false ,false ,false); } //create the Tutorial room objects for (int j = 0; j < Tutorial_count; j++) { Tutorial_rooms = new Tutorial[Tutorial_count]; Tutorial_rooms[j] = new Tutorial("number not set", 0, false, false, false, false ,false ,false); } }
Similar Threads
-
Integers and Lists
By TGH in forum New To JavaReplies: 8Last Post: 01-27-2010, 09:49 AM -
Help with arrays and array lists
By ambernicole88 in forum New To JavaReplies: 3Last Post: 12-04-2009, 09:47 PM -
2 dimensional Lists
By gapper in forum New To JavaReplies: 4Last Post: 01-20-2008, 09:01 AM -
Tudu Lists 2.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 08-10-2007, 04:39 PM -
Tudu Lists 2.0
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-11-2007, 03:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks