Im trying to have put in a list of 10 CD's (with informatiom, not just blank ones) that will ready be in the list before the program even runs. I obviously am new to this, so i dont know what to do. Any help?
This is my program this far:

public class CD{
	private String artist,title;
	private double price;
	private int rating;
	public CD(String a, String t, double p, int r){//Takes in all four parameters
		artist = a;title = t;price = p;rating = r;}
	//Default Constructor
	public CD(){
		this ("Justin Tallio","Greatest Hits",3.5,5);}
	//Copy Constructor 
	public CD(CD that){
	public String getArtist(){
		return artist;}
	public String getTitle(){
		return title;}
	public double getPrice(){
		return price;}
	public int getRating(){
		return rating;}
	public void setArtist(String a){//Sets the artist
		artist = a;}
	public void setTitle(String t){//Sets the title
		title = t;}
	public void setPrice(double p){//Sets the price
		price = p;}
	public void setRating(int r){//Sets the rating b  
		rating = r;}

	public String toString(){//toString
		return( "Artist:"+artist+"\n\tTitle:"+title+"\n\tPrice:"+price+"\n\tRating:"+rating);
public class CD_Collection{
	private int size=10;
	private CD[]colec;
	public CD_Collection(int sz,CD[] holder){//Constructor
		size = sz;colec=holder;}
	public CD_Collection(){//Defaults to an empty CD_Collection with 20 spaces.
		this(0,new CD[20]);}

	public void addCD(CD newCD){//Adds a new CD
	public void totalCost(){//Adds up the sum of all the prices
		double total=0;
		for(int i=0;i<size;i++){
		System.out.println("cost of all your cds: "+total+"\n");}
	public void avgPrice(){//Finds the average price of the CDs
		double Cost=0;
		for(int i=0;i<size;i++){
		System.out.println("Average cost of cds: "+Cost/size+"\n");}

	public void searchByArtist(String seachItem){//Searches by artist, and returns all the information for those CDs 
		String seachCDs="";
		for(int i=0;i<size;i++){
		System.out.println("CD's in your collection by:"+seachItem+": "+ seachCDs);}

	public void searchByTitle(String seachItem){//Searches by title, and returns the CD information.
		String searchTitle="";
		for(int i=0;i<size;i++){
		System.out.println("CD Title"+seachItem+": "+searchTitle);}
	public String toString(){//toString
		String allCDS="";
		for(int i=0;i<size;i++){
			String x=colec[i]+"\n";
		return allCDS;}
}//end class
import TerminalIO.*;
public class CD_Menu{

	public static void main(String[] args){
		CD_Collection group = new CD_Collection();
		KeyboardReader reader = new KeyboardReader();
		int choice=0;
		String choices="What would you like to do?" +//Displays the user with the 6 choices.
		"\n\t1) Add Cd"+
		"\n\t2) Print Collection" +
		"\n\t3) Total Cost" +
		"\n\t4) Average Price" +
		"\n\t5) Search By Artist" +
		"\n\t6) Search By Title ";
		while(choice<6){//If the user enters and number over 6, the program quits.
			choice = reader.readInt(choices);//shows choices to user

			if(choice == 1){//The option for adding a CD
				String title = reader.readLine("Title?");
				String artist = reader.readLine("Artist?");
				double price = reader.readDouble("Price?");
				int rating = reader.readInt("Rating?");
				CD newCD = new CD(title,artist,price,rating);

			else if(choice==2){//The option that prints out all the CD currently stored in the collection.

			else if(choice==3){//The option for printing the total cost.

			else if(choice==4){//The option that finds the average price.

			else if(choice==5){//Search by artist
				String artist = reader.readLine("What artist would you like to search for?");

			else if(choice==6){//Search by title
				String title = reader.readLine("What CD are you looking for?");
		}//end while 
	}//end main
}//end class

Thank you!

This article has been dead for over six months. Start a new discussion instead.