This has to do with the CD program I'm trying to write. I've only gotten up to array lists as a means of collecting information (I'm reading HFJ) and I was wondering -- is it possible to use either of these two to enter a theoretically limitless amount of CD's?
I want to give the CD objects the name CDRecord1(CDRecord1.Artist, CDRecord1.albumTitle, CDRecord2.name, CDRecord2.albumTitle, etc) but I'm not sure how or if I can use that naming method with an Array or an Array List in some kind of a loop to advance to the next record. Can anyone tell me if this is possible or do I have to wait until I read more?
Christopher Laurenzano wrote:A regular array needs to have its size defined, which won't work, because theoretically there are a limitless number of CD's to catalog. So I was thinking that an array list might work.
Christopher Laurenzano wrote:The thing is, currently as I understand an array list, I know I can add a new object, like, for example, CDRecord1 (which would be the first CD entered) and each record would then have its name, album, etc associated with it (using the dot operator). The next record would be named CDRecord2 with all the necessary fields associated with it for that particular CD, and so on.
Christopher Laurenzano wrote:My confusion/obstacle how I would instantiate succeeding CDRecord objects -- somehow finding a way to get the program to create the new object and add it to the list, given the necessity and endless amount of records that could be theoretically added.
Christopher Laurenzano wrote:I want to give the CD objects the name CDRecord1(CDRecord1.Artist, CDRecord1.albumTitle, CDRecord2.name, CDRecord2.albumTitle, etc) but I'm not sure how or if I can use that naming method with an Array or an Array List in some kind of a loop to advance to the next record. Can anyone tell me if this is possible or do I have to wait until I read more?
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|