Hi Friends,
I'm afraid I need help again.... I wrote this program, and it won't compile...and now I have to add to it.

Here is the program:

public class InventoryProgram1App {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("InventoryProgram1App");
        {
            {public class DVD(); }          
        double restockFee = 0.05;
        DVD a = new DVD("Family","PG",restockFee, 1,"Annie");
        DVD b = new DVD("Comedy","PG-13", restockFee, 2, "My Best Friend's Wedding");
        DVD c = new DVD("Comedy","PG-13", restockFee, 3, "The Wedding Planner");
        DVD d = new DVD("Drama","PG-13",restockFee, 4, "Save the Last Dance");

        ShowInventory();
                { setDefaultCloseOperation(); //EXITONCLOSE();
                  { setVisible("true");
                    { setSize ("410, 380");
     }
}

        {public class Inventory.java

{
    public static void main( String args[] )
    {
    int productNum[] = { 1 };
    String productName = "The Devil Wears Prada";
    int productUnits = 20;
    double productPrice = 19.99;
    double productValue;

    productValue = productUnits * productPrice;

    System.out.printf( "\nProduct number: " );
    for ( int counter = 0 ; counter < productNum.length; counter++ )
    System.out.println( productNum[ counter ] = 1 + counter );

    System.out.printf( "ProductName: " );
    System.out.println( productName );

    System.out.printf( "Units: " );
    System.out.println( productUnits );

    System.out.printf( "Price: \u0024" );
    System.out.println( productPrice );

    System.out.printf( "Value: \u0024" );
    System.out.println( productValue );
    System.out.printf( "\n" );

        {

        }

And here is what I have to do to it:
Modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory.
Create a method to calculate the value of the entire inventory.
Create another method to sort the array items by the name of the product.

I'm totally lost -- again....can you please help me?

I'm sorry, but when I see things like the following few snippets

{public class DVD(); }
{ setDefaultCloseOperation(); //EXITONCLOSE();
{ setVisible("true");
{ setSize ("410, 380");
{public class Inventory.java

All I can say is, start over.

LOL. I appreciate your feedback. I am so new at this -- I really have no clue what I'm doing! But I'm willing to learn...

First of all no one is going to spend his precious time trying to understand what you are writing in the way you are writing it. Not even you don't use code tags, but also I cannot understand if you are posting two different files (classes) or one, or where you methods start and finish.
Try to write it better with spaces and don't do this:
{DVD ....

do this:

{
  DVD ...
}

even though it is programmatically wrong. This is the correct

public DVD ( /*arguments*/ ) {
...
}

{
{public class DVD(); }

no doubt these two lines will make your compiler complain instead of compile
through your entire code, you've placed brackets that seem to have appeared out
of thin air, like the one above. also, the class DVD you're trying to create
should better be placed in a new file, DVD.java

DVD a = new DVD("Family","PG",restockFee, 1,"Annie");

problem number two ... even if the above code were correct, this attempt to initialize
an object of the type DVD would still fail, since you have only (tried to) declare a
default constructor. (at least, I assume that is what you tried to do?)

ShowInventory();

not following naming conventions is just a detail here, but you are calling a method that is nowhere
to be found in your code. I didn't find it, and I'm pretty sure the compiler will have the same problem

int productNum[] = { 1 };

what's the use of this? you're declaring an array, I'll give you that
but you limit it to one element.
unlike the assignment you describe, this array will also not be able to hold your
DVD's, but only an integer.

to give you an example: I'll create an array of 5 DVD objects and fill it
with 5 DVD's of "the Devil wears Prada"
(and no, I will not write the entire DVD class that goes along with it,
that's peanuts, and if it isn't, don't try to complete this task)

// this part creates the array of 5 DVD's and puts the DVD's in them
DVD[] dvdCol = new DVD[5];
DVD newDVD = new DVD("The devil wears Prada",19.99);
for(int i = 0; i < dvdCol.length; i++){
	dvdCol[i] = newDVD;
}

// this part takes the array, and prints for each DVD in it the number (1 -> 5), the title and the price
for(int j = 0; j < dvdCol.length; j++){
	System.out.println((j+1) + " Productname: " + dvdCol[j].getTitle() + "   Price: " + dvdCol[j].getPrice());
}

Ok, thank you. I'm afraid I still don't understand. I must be "challenged" regarding this -- I picked up html so fast....and did pretty good in Algorithms and logics. So I don't know why I can't "get" this. But I really appreciate your help. Thank you so much.

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.