Ok thank you for that explanations, but now I have an issue with my code. My remove function doesn't see to be working. Now I think it has to do with the fact it is not setting that CDs information back to empty or 0. Also it only stores 1 cd informations, even if i enter a second 1 cd with different information.

import java.util.Scanner;
public class TestMusicDB {

	/**
	 * @author Alexander Chamerlaion
	 * @Version 1.0
	 * @Date 10/5/11
	 * This program creates a DB and stores values in it
	 * 
	 * 
	 */
	public static void main(String[] args) {
		System.out.println("Music Database");
		Scanner input = new Scanner(System.in);
		String in;
	System.out.println("How many CDs would you like to enter: ");
	int numCD=input.nextInt();
		
		MusicDB mydb= new MusicDB(numCD);

		while(true){
			System.out.println("Welcome to your personal music database.  " +
					"The legal commands are \nq for quit\nd for display\nf for find\na for add\nr for remove");
			
			System.out.println("What is your command");
			in=input.nextLine();
			in.toLowerCase();
			if (in.equals("d")){
				mydb.display();
			}

			else if(in.equals("f")){
				System.out.println("Please enter the title of the CD you would like to search for: ");
				String search = input.nextLine(); 
				search.toLowerCase();
				mydb.find(search);
			}
			else if(in.equals("a")){
				System.out.println("Please enter title of CD: ");
				String cdName = input.nextLine(); 
				System.out.println("Please enter artist name: ");
				String artistName = input.nextLine();
				System.out.println("Please enter total track number: ");
				int tnum = 0;
				tnum = input.nextInt();
				System.out.println("Please enter copyright year: ");
				int year = 0;
				year = input.nextInt();
				MusicCD newCD = new MusicCD(cdName, artistName,tnum,year);
				mydb.add(newCD);

			}
			else if(in.equals("r")){
				System.out.println("Please enter the title of the album you want to remove (must be how you entered it) ");
				String remove = input.nextLine();
				mydb.remove(remove);
				
			}
			else if(in.equals("q")){
				System.out.println("Goodbye.");
				break;
			}
		}
	}

}
import java.util.Scanner;
public class MusicCD {
	private String cd;
	private String artist;
	private int tracknum;
	private int cright;
	public MusicCD(String cdName, String artistName, int tnum, int year){
		cd=cdName;
		artist=artistName;
		tracknum=tnum;
		cright=year;
	}
	public String getCD(){
		return cd;
	}
	public void setCD(String cdName){
		this.cd=cd;
	}
	public String getArtist(){
		return artist;
	}
	public void setArtist(String artistName){
		this.artist=artist;
	}
	public int getTracknum(){
		return tracknum;
	}
	public void setTracknum(int tnum){
		
	}
	public int getCright(){
		return cright;
	}
	public void setCright(int year){
		this.cright=cright;
	}
	public String toString(int i){
		return "\nCD Title: " + cd + " \nArtist: " + artist + " \nTotal Track Number: "+tracknum+" \nCopyright Year: "+cright; 
		}
	
}
public class MusicDB {
	private MusicCD[] numofcd;  
	private int count;
	public int length;
	int numCD=0;


	public MusicDB(int numCD){

		numofcd = new MusicCD[numCD]; 
		length = numCD;
		
		count = 0;

	}

	public void add(MusicCD cd){
		if(count < length){
			numofcd[count] = cd;
			count++;
		}
		else{
			System.out.println("Your database is full");
		}
	}
	public void display(){
		for(int i = 0; i<count; i++){                         
			System.out.println(numofcd[numCD].toString(numCD));
		}
	}

	public void find (String search){
		boolean found = false;
		for (MusicCD cds : numofcd ) {          		        
			if (search.equals(cds.getCD())) {    
				found = true;
				System.out.println("Your search was found ");
				break;
			}
			else{
				System.out.println("Your search could not be found try again ");
			}
		}



	}
	public void remove(String search){
		boolean found = false;
		for (MusicCD cds : numofcd ) {          		        
			if (search.equals(cds.getCD())) {    
				found = true;
				System.out.println("Your search was found ");
				cds.setCD("");
				cds.setArtist("");
				cds.setTracknum(0);
				cds.setCright(0);
				break;
			}
			else{
				System.out.println("Your search could not be found try again ");
			}
		}

	}
}
public void display(){
for(int i = 0; i<count; i++){
System.out.println(numofcd[numCD].toString(numCD));

Shouldn't you use i to index into the array?

I am just using arrays for the first time, so would I just use index instead of numCD?

I assume you want to print numofcd[0], numofcd[1] etc, so the variable in the [] needs to change on each iteration of the loop.
Your loop variable "i" is perfectly designed for that use.
Your "numCD" doesn't change, so it can't be the right thing to use.

Alright great just as simple as adding

public void display(){
for(int i = 0; i<count; i++){
System.out.println(numofcd[i].toString(i));

Now on to the remove portion why is isn't is settting the Cd that I can back to Zero

Is it because there's no loop for it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.