OK here is my program so far and I'm getting a compile error on my constructor located in class Inventory on line 50

// Inventory Program Part 2

import java.util.Scanner;
//Inventory program
//This program monitors DVD inventory, price, and stock

public class Inventory
{//new class inventory
	public static void main (String args[])
	{//begin main method
		System.out.print("Welcome to the DVD inventory program");//welcome
		System.out.println();//blank line
		System.out.println("This program monitors DVD inventory, price, and stock.");//program purpose
		System.out.println();//blank line
		
		//declare variables
		String DvdTitle;
		double ItemNumber = 0.00;
		double DvdPrice = 0.00;
		int NumberInStock = 0;
		int count;//counter control variable
		double restockFee = 0.00;
		
		Scanner input = new Scanner (System.in);
		
		System.out.println("How many DVDs would you like to enter?");//prompt for length of array
		count = input.nextInt();//accept user input
		String getRidOfThisNewline = input.nextLine();//gets rid of the newline created by pressing <enter>

		//declare arrays
		DVD[] myDVD = new DVD[count];

		for (int i = 0; i<count; i++)
		{//We want to 'count' number of new DVD's.

			System.out.println();//blank line

			System.out.println("Enter title of DVD. ");//prompt for title
			DvdTitle = input.nextLine();//accept user input
			System.out.println();//blank line

			System.out.println("Please enter item Number.");//request item number
			ItemNumber = input.nextDouble();//user input item number as double
			System.out.println();//blank line

			System.out.println("Please enter price of DVD.");//request price
			DvdPrice = input.nextDouble();//accept user input

			 
			DVD newDVD = new DVD(DvdTitle, ItemNumber, DvdPrice, NumberInStock);
			   
			//Put the dvd you just created into the array of DVDs.

			myDVD[count] = newDVD;
		}//end for
		
		double DvdValue = (DvdPrice*NumberInStock);
		
		//double totalInventory = computeValue();
		for (int i = 0; i<count; i++)
		{//print information from array
			System.out.println("DVD Title:" + DvdTitle);
			System.out.println("Item Number:" + ItemNumber);
			System.out.println("Price:" + DvdPrice);
			System.out.println("Number in Stock:" + NumberInStock);
			System.out.println("Stock Value:" + DvdValue);
			System.out.println();//blank line
		}//end for
		//System.out.println("Total Inventory:" +totalInventory);
	}//end main method
	
	//private static double computeValue()
	//{
		//double DvdValue = 0.00;
		//for (int i = 0; i<DVDArray.length; i++)
		//{
		//	DvdValue += ;
		//}
		//return StockValue;
	//}//end method
}//end inventory class

here is my subclass of DVD

public class DVD
{

	//declare variables
	String DvdTitle = "";
	double ItemNumber = 0.00;
	double DvdPrice = 0.00;
	int NumberInStock = 0;
	double restockFee = 0.00;

	//constructor
	public DVD (String DvdTitle, double ItemNumber, double DvdPrice, int NumberInStock, double RestockFee)
	{
		this.DvdTitle = DvdTitle;
		this.ItemNumber = ItemNumber;
		this.DvdPrice = DvdPrice;
		this.NumberInStock = NumberInStock;
		this.restockFee = RestockFee;
	}

	//get and set methods
	public String getDvdTitle()
	{
		return DvdTitle;
	}

	public void setDvdTitle(String DvdTitle)
	{
		this.DvdTitle = DvdTitle;
	}

	public double getItemNumber()
	{
		return ItemNumber;
	}

	public void setItemNumber(double ItemNumber)
	{
		this.ItemNumber = ItemNumber;
	}

	public double getDvdPrice()
	{
		return DvdPrice;
	}

	public void setDvdPrice(double DvdPrice)
	{
		this.DvdPrice = DvdPrice;
	}

	public int getNumberInStock()
	{
		return NumberInStock;
	}

	public void setNumberInStock(int NumberInStock){
		this.NumberInStock = NumberInStock;
	}

	public double getRestockFee(){
		return (NumberInStock * DvdPrice * .05);
	}
}// End Class DVD

Because you have constructor for 5 parameters public DVD (String DvdTitle, double ItemNumber, double DvdPrice, int NumberInStock, double RestockFee) but passing only 3 new DVD(DvdTitle, ItemNumber, DvdPrice, NumberInStock); . Create another constructor that will accept only 3 parameters and you done

Thanks,
I made the constructor to pass all 5 parameters all of my code is the same until this section, which now gives me an error that states:
variable DvdTitle might not have been initialized
it references what in this post is line # 14

DVD newDVD = new DVD(DvdTitle, ItemNumber, DvdPrice, NumberInStock, RestockFee);
			   
			//Put the dvd you just created into the array of DVDs.

			myDVD[count] = newDVD;
		}//end for
		
		double DvdValue = (DvdPrice*NumberInStock);
		
		//double totalInventory = computeValue();
		for (int i = 0; i<count; i++)
		{//print information from array
			System.out.println("DVD Title:" + DvdTitle);
			System.out.println("Item Number:" + ItemNumber);
			System.out.println("Price:" + DvdPrice);
			System.out.println("Number in Stock:" + NumberInStock);
			System.out.println("Stock Value:" + DvdValue);
			System.out.println();//blank line
		}//end for

variable DvdTitle might not have been initialized

Where is the variable: DvdTitle initialized?
The compiler wants you to assign it a value before you try to use 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.