Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26
  1. #21
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

  2. #22
    offfbyheart is offline Member
    Join Date
    May 2011
    Posts
    13
    Rep Power
    0

    Default

    Thank you Toll, could you elaborate on which string or part that I have not set the rating or number for? I am so confused. But thanks to you I fixed the problem with the number of songs thing.

  3. #23
    offfbyheart is offline Member
    Join Date
    May 2011
    Posts
    13
    Rep Power
    0

    Default

    Which classes are repeated sunde887? And which ones are unnecessary? It's finally coming together!

  4. #24
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    393
    Rep Power
    4

    Default

    From what I understand, your input-loop looks like this now:
    PHP Code:
           for (int count = 0; count < numberOfSongs; count++)
    		{
    		   songList[count] = new PlayList();
    			
    			
    			System.out.print("Who is song #"+(count+1)+" written by? ");
    		   inputText = in.nextLine();
    		   songList[count].setArtistName(inputText);
    			
    			System.out.print("What is song #"+(count+1)+"\'s title? ");
    		   inputText = in.nextLine();
    		   songList[count].setAlbumTitle(inputText);
    		
    		   System.out.print("What is song #"+(count+1)+"\'s album titled? ");
    		   inputText = in.nextLine();
    		   songList[count].setSongTitle(inputText);
    
    		   System.out.print("What is song #"+(count+1)+"\'s rating? (From 1 - 5. With 1 being the lowest.) ");
    		   inputText = in.nextLine();
    		   songList[count].setSongRating(Integer.parseInt(inputText));
    			
    			  }
    I cannot see any call to setSongNumber() in there. As I edited in though, the rating thing has been fixed.

  5. #25
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    The PlayListBuilder and PlayListBuilderArray are basically the same classes. There is one line that seperates them and it's that you get the input for the rating but you don't use it.

  6. #26
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    393
    Rep Power
    4

    Default

    Oh, and also... If it's more than just an experimentation-program, you might want to add a try clause around songList[count].setSongRating(Integer.parseInt(inputText)); . Otherwise, a slip of a finger could break the program and throw an exception.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Array code problem
    By raladin3d in forum New To Java
    Replies: 4
    Last Post: 04-11-2011, 07:50 AM
  2. Array Code difficulties
    By NixasMuraki in forum New To Java
    Replies: 2
    Last Post: 02-08-2011, 01:17 AM
  3. code using array
    By java008 in forum New To Java
    Replies: 11
    Last Post: 12-18-2008, 11:44 AM
  4. please i need the code of comparing these two array lists.
    By raj reddy in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 04-18-2008, 08:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •