Need help with inventory program!!! someone please help me!!!

Ok I have to write this inventory program for one of my classes.
For part one i needed to Create a product class that holds the item number, the name of product, the number of units in stock, and the price of each unit.
Then create a java application that displays all of the above info plus the total value of the inventory. I have done this so far with success.
For part two i needed to modify the 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 per unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory.
so create a method to calculate the value of the entire inventory.(i did this)
and create another method to sort the array items by the name of the product. ( i did this)
The program compiles and runs fine except it is not doing anything from part two. It just does the same thing that it did when i wrote part one.
Does anyone know why or what i need to do to my code.
Here is my code.
import java.util.Scanner; // program uses class Scanner
import java.util.Arrays;
class ProductList
  Product[] products = new Product[100]; // an array of 100 pruducts
  private void populate() {
    products[0] = new Product(0, "Good Luck Chuck"      , 25, 4.95);
    products[1] = new Product(1, "The Bourne Identity"  ,  3, 7.95);
    products[2] = new Product(2, "The Reaping"          ,  5, 8.99);
      products[3] = new Product(3, "Deja Vu"              ,  2,12.99);
      products[4] = new Product(4, "I Know Who Killed Me" ,  3,10.95);
  private void sortByTitle() {
  private void print() {
    for(int i=0; i<products.length; i++) {
      System.out.println(products);
private void printTotalInventoryValue() {
System.out.println("Total Inventory Value = "+calculateTotalInventoryValue());
private double calculateTotalInventoryValue() {
double total = 0D;
for(int i=0; i<products.length; i++) {
total += products[i].calculateInventoryValue();
return total;
public static void main( String args[] ) {
ProductList list = new ProductList();
list.populate();
list.sortByTitle();
list.print();
list.printTotalInventoryValue();
} class Product
private int id;
private String title;
private int stock;
private double price;
public Product(int id, String title, int stock, double price) {
setId(id);
setTitle(title);
setStock(stock);
setPrice(price);
public int getId() { return this.id; }
public void setId(int id) { this.id = id; }
public String getTitle() { return this.title; }
public void setTitle(String title) { this.title = title; }
public int getStock() { return this.stock; }
public void setStock(int stock) { this.stock = stock; }
public double getPrice() { return this.price; }
public void setPrice(double price) { this.price = price; }
public double calculateInventoryValue() {
return getStock() * getPrice();
public class Inventorypt2
private String ProductInfo; // call class product info
public static void main(String args[])
//create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int num; // product's item number
int stock; // number of items in stock
double price; // price each of item
ProductInfo product; // product information instance
System.out.println(); // blank line
String name = "go";
// loop until sentinel value read from user
while ( !name.equalsIgnoreCase ("stop") )
System.out.print( "Enter DVD title, or STOP to quit: "); // prompt
name = input.nextLine(); // read item name from user or quit
System.out.print( "Enter the item number: "); // prompt
num = input.nextInt(); // read item number from user
while ( num <=0 ) //loop until item number is positive
System.out.println ("Item number must be positive. Please re-enter item number: ");//prompt user to re-enter item number
num = input.nextInt(); // read item number
} //end while
System.out.print( "Enter the quantity in stock: "); // prompt
stock = input.nextInt(); // read stock quantity from user
while ( stock <0 ) //loop until stock is positive
System.out.println ("Quantity in stock can not be less than zero. Please re-enter the quantity in stock: ");//prompt user to re-enter quantity in stock
stock = input.nextInt(); // read stock quantity from user
} //end while
System.out.print( "Enter the price of DVD: "); // prompt
price = input.nextDouble(); // read item price from user
while ( price <=0 ) //loop until price is positive
System.out.println ("Product price must be positive. Please re-enter the price of the product: ");//prompt user to re-enter product price
price = input.nextDouble(); // read item price from user
} //end while
product = new ProductInfo( num, name, stock, price); // initialize ProductInfo variables
System.out.println(); // blank line
System.out.printf( "Item Name: %S\n", product.getName());
System.out.printf( "Item Number: %s\n", product.getNum());
System.out.printf( "Qty. in Stock: %s\n", product.getStock());
System.out.printf( "Price Each: $%.2f\n", product.getPrice());
System.out.printf( "Total Value in Stock: $%.2f\n", product.getInventoryTotal());
System.out.println(); // blank line
System.out.print( "Enter DVD title, or STOP to quit: "); // prompt
name = "";
while ( name.equals("") )
name = input.nextLine(); // read new product name from user or quit
} //end while
System.out.println(); // blank line
System.out.println("Good Bye!"); // exit message
Edited by: jay1981 on Mar 16, 2008 2:07 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

You will get more help if your code is formatted better:
* Only post code that is already formatted correctly including indentations.
* Get rid of all those comments cluttering up your code.
* Make sure your posted code compiles without need for any changes. Yours doesn't at present. Where is the ProductInfo class?
Again, you want it easy for a volunteer here to read your post, otherwise he/she simply won't do it. Good luck.

Similar Messages

  • Error with Autoloader program - someone please help - so frustrated

    HI there.... I am a wedding photography and use Mike d's autoloader program to zip through my wedding edits...it was working great until yesterday... I use it through bridge and when I try to ope the files, the autoloader comes up fine ..I pick my action....hit save and then I get a ps error 21 object is null line 1026 and then it I close that and hit the preassigned key to open up the files I get another error ps 8000 cannot open files beciase open options are incorrect.....I have tried reinstalling, updating, asking adobe forhelp ( they won't help becuase it is a third party program even though it is giving me ps errors), I have contacted Mike D the creator of the program and he is not sure what is going on either....any ideas at all ?  I am at a loss and rely on this program to make the workflow much quicker!  Any help would be appreciated
    Jill

    Have you received a resolution for this yet?   I'm having exactly the same problem -- I purchased this software yesterday, got it set up, and ran through my first folder of images with no problem.   When I tried to run the tool through my second batch of images, I got the error 21.   I contacted Mike D, but he hasn't responded.   Meanwhile I tried several combinations of uninstalling and reinstalling, rebooting, and switching to a different image file to try and resolve, all with no luck whatsoever.  If you have a solution that you could share with me, I would really appreciate it!
    Thanks!

  • I tried updating my iPod 5th gen to iOS 8 but it only shows me a picture of the iTunes logo and a charger at the bottom, I'm not sure what this means or what I need to do. Can someone please help me?

    I tried updating my iPod 5th gen to iOS 8 but it only shows me a picture of the iTunes logo and a charger at the bottom, I'm not sure what this means or what I need to do. Can someone please help me?

    After restoring to factory settings/new iPod you will then have to restore from backup
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes       
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:                         
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • Need help with Inventory program part 6

    if any one can help or give me a clue to how to do this Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an item number one more than the previous last item.
    ? Add a Save button to the GUI that saves the inventory to a C:\data\inventory.dat file.
    ? Use exception handling to create the directory and file if necessary.
    ? Add a search button to the GUI that allows the user to search for an item in the inventory by the product name. If the product is not found, the GUI should display an appropriate message. If the product is found, the GUI should display that product?s information in the GUI.
    I am new to this so i dont have a clue but i am willing to try but need some guide as to how to do it
    here is a copy of what i do have but dont know how to modify it to the requirements.
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class Inventory2
    static int dispProd = 0; // variable for actionEvents
    //main method begins execution of java application
    public static void main(final String args[])
    int i; // varialbe for looping
    double total = 0; // variable for total inventory
    // Instantiate a product object
    final ProductAdd[] nwProduct = new ProductAdd[5];
    // Instantiate objects for the array
    for (i=0; i<5; i++)
    nwProduct[0] = new ProductAdd("Paper", 101, 10, 1.00, "Box");
    nwProduct[1] = new ProductAdd("Pen", 102, 10, 0.75, "Pack");
    nwProduct[2] = new ProductAdd("Pencil", 103, 10, 0.50, "Pack");
    nwProduct[3] = new ProductAdd("Staples", 104, 10, 1.00, "Box");
    nwProduct[4] = new ProductAdd("Clip Board", 105, 10, 3.00, "Two Pack");
    for (i=0; i<5; i++)
    total += nwProduct.length; // calculate total inventory cost
    final JButton firstBtn = new JButton("First"); // first button
    final JButton prevBtn = new JButton("Previous"); // previous button
    final JButton nextBtn = new JButton("Next"); // next button
    final JButton lastBtn = new JButton("Last"); // last button
    final JLabel label; // logo
    final JTextArea textArea; // text area for product list
    final JPanel buttonJPanel; // panel to hold buttons
    //JLabel constructor for logo
    Icon logo = new ImageIcon("C:/logo.jpg"); // load logo
    label = new JLabel(logo); // create logo label
    label.setToolTipText("Company Logo"); // create tooltip
    buttonJPanel = new JPanel(); // set up panel
    buttonJPanel.setLayout( new GridLayout(1, 4)); //set layout
    // add buttons to buttonPanel
    buttonJPanel.add(firstBtn);
    buttonJPanel.add(prevBtn);
    buttonJPanel.add(nextBtn);
    buttonJPanel.add(lastBtn);
    textArea = new JTextArea(nwProduct[3]+"\n"); // create textArea for product display
    // add total inventory value to GUI
    textArea.append("\nTotal value of Inventory "+new java.text.DecimalFormat("$0.00").format(total)+"\n\n");
    textArea.setEditable(false); // make text uneditable in main display
    JFrame invFrame = new JFrame(); // create JFrame container
    invFrame.setLayout(new BorderLayout()); // set layout
    invFrame.getContentPane().add(new JScrollPane(textArea), BorderLayout.CENTER); // add textArea to JFrame
    invFrame.getContentPane().add(buttonJPanel, BorderLayout.SOUTH); // add buttons to JFrame
    invFrame.getContentPane().add(label, BorderLayout.NORTH); // add logo to JFrame
    invFrame.setTitle("Office Min Inventory"); // set JFrame title
    invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // termination command
    //invFrame.pack();
    invFrame.setSize(400, 400); // set size of JPanel
    invFrame.setLocationRelativeTo(null); // set screem location
    invFrame.setVisible(true); // display window
    // assign actionListener and actionEvent for each button
    firstBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    dispProd = 0;
    textArea.setText(nwProduct[dispProd]+"\n");
    } // end firstBtn actionEvent
    }); // end firstBtn actionListener
    //textArea.setText(nwProduct[4]+"n");
    prevBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    dispProd--;
    if (dispProd < 0)
    dispProd = 0;
    //dispProd = (nwProduct.length+dispProd-1) % nwProduct.length;
    textArea.setText(nwProduct[dispProd]+"\n");
    } // end prevBtn actionEvent
    }); // end prevBtn actionListener
    lastBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    dispProd = nwProduct.length-1;
    textArea.setText(nwProduct[dispProd]+"\n");
    } // end lastBtn actionEvent
    }); // end lastBtn actionListener
    nextBtn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    dispProd++;
    if (dispProd >= nwProduct.length)
    dispProd = nwProduct.length-1;
    textArea.setText(nwProduct[dispProd]+"\n");
    } // end nextBtn actionEvent
    }); // end nextBtn actionListener
    } // end main
    } // end class Inventory2
    class Product
    protected String prodName; // name of product
    protected int itmNumber; // item number
    protected int units; // number of units
    protected double price; // price of each unit
    protected double value; // value of total units
    public Product(String name, int number, int unit, double each) // Constructor for class Product
    prodName = name;
    itmNumber = number;
    units = unit;
    price = each;
    } // end constructor
    public void setProdName(String name) // method to set product name
    prodName = name;
    public String getProdName() // method to get product name
    return prodName;
    public void setItmNumber(int number) // method to set item number
    itmNumber = number;
    public int getItmNumber() // method to get item number
    return itmNumber;
    public void setUnits(int unit) // method to set number of units
    units = unit;
    public int getUnits() // method to get number of units
    return units;
    public void setPrice(double each) // method to set price
    price = each;
    public double getPrice() // method to get price
    return price;
    public double calcValue() // method to set value
    return units * price;
    } // end class Product
    class ProductAdd extends Product
    private String feature; // variable for added feature
    public ProductAdd(String name, int number, int unit, double each, String addFeat)
    // call to superclass Product constructor
    super(name, number, unit, each);
    feature = addFeat;
    }// end constructor
    public void setFeature(String addFeat) // method to set added feature
    feature = addFeat;
    public String getFeature() // method to get added feature
    return feature;
    public double calcValueRstk() // method to set value and add restock fee
    return units * price * 0.05;
    public String toString()
    return String.format("Product: %s\nItem Number: %d\nIn Stock: %d\nPrice: $%.2f\nType: %s\nTotal Value of Stock: $%.2f\nRestock Cost: $%.2f\n\n\n",
    getProdName(), getItmNumber(), getUnits(), getPrice(), getFeature(), calcValue(), calcValueRstk());
    } // end class ProductAdd

    Try these modifications at your own risk:
    import java.awt.BorderLayout;
    import java.awt.Font;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class Inventory2
        static int dispProd = 0; // variable for actionEvents
        // main method begins execution of java application
        static JTextArea textArea;
        public static void main(final String args[])
            int i; // varialbe for looping
            double total = 0; // variable for total inventory
            // Instantiate a product object
            final ProductAdd[] nwProduct = new ProductAdd[5];
            // Instantiate objects for the array
            for (i = 0; i < 5; i++)
                nwProduct[0] = new ProductAdd("Paper", 101, 10, 1.00, "Box");
                nwProduct[1] = new ProductAdd("Pen", 102, 10, 0.75, "Pack");
                nwProduct[2] = new ProductAdd("Pencil", 103, 10, 0.50, "Pack");
                nwProduct[3] = new ProductAdd("Staples", 104, 10, 1.00, "Box");
                nwProduct[4] = new ProductAdd("Clip Board", 105, 10, 3.00,
                        "Two Pack");
            for (i = 0; i < 5; i++)
                total += nwProduct.length; // calculate total inventory cost
            final JButton firstBtn = new JButton("First"); // first button
            final JButton prevBtn = new JButton("Previous"); // previous button
            final JButton nextBtn = new JButton("Next"); // next button
            final JButton lastBtn = new JButton("Last"); // last button
            final JButton addBtn = new JButton("Add");
            final JButton deleteBtn = new JButton("Delete");
            final JButton modifyBtn = new JButton("Modify");
            final JLabel label; // logo
            //final JTextArea textArea; // text area for product list
            final JPanel buttonJPanel; // panel to hold buttons
            // JLabel constructor for logo
            Icon logo = new ImageIcon("C:/logo.jpg"); // load logo
            label = new JLabel(logo); // create logo label
            label.setToolTipText("Company Logo"); // create tooltip
            buttonJPanel = new JPanel(); // set up panel
            buttonJPanel.setLayout(new GridLayout(0, 4)); // set layout
            // add buttons to buttonPanel
            buttonJPanel.add(firstBtn);
            buttonJPanel.add(prevBtn);
            buttonJPanel.add(nextBtn);
            buttonJPanel.add(lastBtn);
            buttonJPanel.add(addBtn);
            buttonJPanel.add(deleteBtn);
            buttonJPanel.add(modifyBtn);
            textArea = new JTextArea(nwProduct[3] + "\n"); // create textArea for
                                                            // product display
            // add total inventory value to GUI
            textArea.append("\nTotal value of Inventory "
                    + new java.text.DecimalFormat("$0.00").format(total) + "\n\n");
            textArea.setEditable(false); // make text uneditable in main display
            JFrame invFrame = new JFrame(); // create JFrame container
            invFrame.setLayout(new BorderLayout()); // set layout
            invFrame.getContentPane().add(new JScrollPane(textArea),
                    BorderLayout.CENTER); // add textArea to JFrame
            invFrame.getContentPane().add(buttonJPanel, BorderLayout.SOUTH); // add
                                                                                // buttons
                                                                                // to
                                                                                // JFrame
            invFrame.getContentPane().add(label, BorderLayout.NORTH); // add logo
                                                                        // to JFrame
            invFrame.setTitle("Office Min Inventory"); // set JFrame title
            invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // termination
                                                                        // command
            // invFrame.pack();
            invFrame.setSize(400, 400); // set size of JPanel
            invFrame.setLocationRelativeTo(null); // set screem location
            invFrame.setVisible(true); // display window
            // assign actionListener and actionEvent for each button
            firstBtn.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    dispProd = 0;
                    textArea.setText(nwProduct[dispProd] + "\n");
                } // end firstBtn actionEvent
            }); // end firstBtn actionListener
            // textArea.setText(nwProduct[4]+"n");
            prevBtn.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    dispProd--;
                    if (dispProd < 0)
                        dispProd = 0;
                    // dispProd = (nwProduct.length+dispProd-1) % nwProduct.length;
                    textArea.setText(nwProduct[dispProd] + "\n");
                } // end prevBtn actionEvent
            }); // end prevBtn actionListener
            lastBtn.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    dispProd = nwProduct.length - 1;
                    textArea.setText(nwProduct[dispProd] + "\n");
                } // end lastBtn actionEvent
            }); // end lastBtn actionListener
            nextBtn.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    dispProd++;
                    if (dispProd >= nwProduct.length)
                        dispProd = nwProduct.length - 1;
                    textArea.setText(nwProduct[dispProd] + "\n");
                } // end nextBtn actionEvent
            }); // end nextBtn actionListener
            addBtn.addActionListener(new extraBtnAxnL());
            deleteBtn.addActionListener(new extraBtnAxnL());
            modifyBtn.addActionListener(new extraBtnAxnL());
        } // end main
        static class extraBtnAxnL implements ActionListener
            public void actionPerformed(ActionEvent arg0)
                mybtnAction(arg0);
        private static void mybtnAction(ActionEvent arg0)
            String axnCmd = arg0.getActionCommand();
            Font oldFont = textArea.getFont();
            textArea.setFont(new Font(oldFont.getName(), Font.BOLD, 16));
            if (axnCmd.equalsIgnoreCase("add"))
                textArea.setText(new String(asqasp));
            else if (axnCmd.equalsIgnoreCase("delete"))
                textArea.setText(new String(iow));
            else if (axnCmd.equalsIgnoreCase("modify"))
                textArea.setText(new String(dyogdhw));
        private static byte[] asqasp =
                0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x75, 0x6d, 0x20,
                0x69, 0x73, 0x20, 0x61, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20,
                0x74, 0x6f, 0x20, 0x61, 0x73, 0x6b, 0x20, 0x73, 0x70, 0x65, 0x63,
                0x69, 0x66, 0x69, 0x63, 0x20, 0x0a, 0x71, 0x75, 0x65, 0x73, 0x74,
                0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20,
                0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72,
                0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x73, 0x2e, 0x0a, 0x0a, 0x4e, 0x6f,
                0x74, 0x20, 0x61, 0x20, 0x73, 0x69, 0x74, 0x65, 0x20, 0x74, 0x6f,
                0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x6a,
                0x65, 0x63, 0x74, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
                0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x0a, 0x61, 0x6e, 0x64, 0x20,
                0x61, 0x73, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x67, 0x65, 0x6e,
                0x65, 0x72, 0x61, 0x6c, 0x20, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69,
                0x6f, 0x6e, 0x73, 0x2e
        private static byte[] iow =
                0x49, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x77, 0x6f,
                0x72, 0x64, 0x73, 0x2e, 0x2e, 0x2e
        private static byte[] dyogdhw =
                0x44, 0x6f, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x6f, 0x77, 0x6e,
                0x20, 0x67, 0x6f, 0x64, 0x2d, 0x64, 0x61, 0x6d, 0x6e, 0x20, 0x68,
                0x6f, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x21
    } // end class Inventory2Message was edited by:
    petes1234

  • HT1414 i am in the process of getting my iphone4 unlocked from att to use it on straighttalk. why do i need to "back up" the iphone and all of this? i dont have an apple computer sooo, im a little confused on why i need to do this. can someone please help

    Can someone please explain and help me? I am unlocking an iphone4 from at&amp;t to use it on the straight talk network. They've confirmed my request to do this and I am now a little confused as to what to do next. They want me to back up the phone using itunes on either a MAC or PC. I do not have an aplle computer but I do have an acer. Sooo, can I use it to do this? Or do I even have to do this to unlock and switch the iphone4 over to a new network? If I do have to what can I do to do this because like I said I do not have a computer by apple? Can anybody walk me through what I need to do next please? I've been waiting to do this for a very long time and I now have the option to have an iphone and use it. Thanks to my awesome boyfriend who Gave me his old iphone when he swapped back to an android. Hahahaha! Please anybody!? Because I sooo don't know what I'm doing and really do not want to mess the phone Or the process up. Thanks to any and all who read this and help me! It is greatly appreciate it!

    Install iTunes on your Acer and you can back up the iPhone. Or back it up to iCloud. If you do not back it up you can get it unlocked, but you will lose all of your content.
    You can get iTunes from http://www.apple.com/itunes.
    Even after unlocking I'm not sure it will work on Straight Talk, because last time I checked ST used Verizon as its carrier, and an AT&T iPhone 4 is not compatible with Verizon's network. You can probably use it on Net 10 or T-Mobile once it is unlocked.

  • HP Protect tool password manager not working with the new version of Mozilla: I got this alert: "Firefox doesn't know how to open this address, because the protocol (dpql) isn't associated with any program." please help

    I have an HP ProBook 4520s. I have been using HP Protect tool's Password manager to store and manage my passords for all Login websites in Firefox 3.6. As a result, I just swiped my fingerprint to log on to any website.
    After I installed the version 4 of Firefox, my all my login details do not work anymore. I have tried to reset them but I repeatedly get this error: "Firefox doesn't know how to open this address, because the protocol (dpql) isn't associated with any program."
    something like this would have been passed onto the address: "dpql://c:\program%20files%20(x86)\hewlett-packard\hp%20protecttools%20security%20manager\bin\dpminionlineids.dll/qlinkload.htm#id=2".
    Although the password manager works with Internet Explorer 9, I need it to work with Firefox 4 as this is my preferred browser.
    Please help. Thank you!

    I guess this means that IE is more user friendly for HP Password Manager finger swipe recall of passwords, a favorite of mine. I still don't see a post from Firefox as to why they haven't produced fix. So I'll switch to IE until things change. I don't see value in downgrading to a Firefox version that's no longer going to be supported.

  • Need Help with Rotating Banner ad(please help)

    I am currently working on a flash project that rotates banners out auto and with button control, got the buttons to work just cant figure out how to get it  auto play throgh my bannersThis is the code i have for my project I am working on:
    My Projects has 3 layers:
    ( layer3)Actions:(coded on first frame)     Movieclip.prototype.elasticMove =  function(target, accel, convert) {
         step = step * accel + (target - this._x) * convert;
         this._x += step;
    (layer 2) My movie clip(it is one long strip that has all the banners in a row)(coded on first frame):nClipEvent  (enterFrame) {
                                         elasticMove(_root.newX, 0.5, 0.3)
    onClipEvent(load){
    _root.newX= 1200;
    (layer1)(my buttons)(only code for one button all are the same code except the actual position they call):on(release){
    _root.newX=1200;
    Let me know if i need to be a little more clear or you want a snap shot of my work, Another individual suggested that I use this code in the action layer:
    var newXA:Array=[0,600,1200,1800];
    var index:Number=1;
    setInterval(newXF,9000);
    function newXF(){
    _root.newX = newXA[index%newXA.length];
    It seems to work in the sense after a little bit it does change the banner auto and after you stayed on a banner for a while, but it always changes to the same banner.
    PLEASE HELP SOMEONE!!!!!!

    Incognito mode is a Google Chrome setting when you open a new window (Cmd+Shift+N on a Mac Ctrl+Shift+N on Windows) It opens a "private" window with no cookies and no tracking. The problem with it is that when you disable cookies, your license files are not sent to the site (whetehr it's YouTube or xFinity or any other that uses license files for paid content)  and it treats you as if you're a first time visitor. Paid videos won't play wihtout the cookies sending the license file info.
    This isn't a Flash Player setting. It's in Chrome. I did some research and according to Google, "Incignito" mode is off by default, and can ONLY be activate by the keyboard shortcut. There IS a way to disable it from the registry http://dev.chromium.org/administrators/policy-list-3#IncognitoModeAvailability

  • Need help with merging contacts! Please help!!!

    Hey guys. I have a little problem with my iPhone 4 with iOS 7. I have recently synced all of my contacts with iCloud so that I will be able to export them to my pc, but this is not the problem. Since I was deleting some of the contacts I have noticed that there is a possibility (in the Edit Mode of the contact) to add a Facebook profile. So I tried to do this with a few contacts.
    I am attaching a photo of how my contact with Facebook profile linked to it looks like but it's in iCloud (I get the same thing on my iPhone).
    Sorry for all the black lines. So when I press the name Betyna ... under the Facebook option I get a new Facebook tab open which says - Page not found. Sorry, this page isn't available. The link you followed may be broken, or the page may have been removed.
    This is the same thing I get on my phone.
    Can someone help me with a solution to my problem, because I really want to link Facebook profiles to my phone contacts, but without the whole Settings/Facebook/Update Contacts and all?
    So please help!!!!!

    I'm creating an input source from the string, then i
    pass it to the parser. No, you don't. Look at the source again.
    byteStream = new
    new ByteArrayInputStream(string.getBytes());
    InputSource is = new InputSource(byteStream);
    parser.parse(byteStream, myParser);//the line that
    hat throws the exceptionYou aren't passing the InputSource to the parser at all.
    However, why are you using this roundabout way to pass the string to the parser? Why not justparser.parse(new InputSource(new StringReader(string)), myParser);?

  • Help with arrays...Please Help

    Hello,
    Iam trying to make a library system. I have three classes, one for the GUI, User class, and Users class. User class instantiates an object with all the relevant data like, Name, Age, Address, etc. The Users class contains a array of User Objects.
    With this program I have to be able to create users, display users and delete users. The problem Iam having is displaying them. (I think I correctly store the User Objectsin the array, and Iam having problems retreiving them). The thing is when I run the program I don't get any exception errors, just nothing gets displayed!
    Here is part of my code:
    public class Users {
    //declaring variables
    public Users (){
    initialiseArray();
    public void initialiseArray(){
    userArray = new User [50];
    // This method first checks to see if there is enough room for a new
    // user object. If there is the object is added to the array, if there is'nt
    // Then method expandUserArray is called to make room for the user
    public void addUser( User user)
    if (userArraySize == userArray.length) {
    expandUserArray();
    userArray[userArraySize] = user;
    userArraySize++;
    // In this method first the user is searched for in the array, if found
    // Then method decreaseUserArray is called to delete the user
    public void deleteUser ( User user )
    location = 0;
    while (location < userArraySize && userArray[location] != user) {
    location++;
    if (userArray[location] == user) {
    decreaseUserArray(location);
    public void displayUsers( ){
    for (int i = 0; i < userArraySize; i++) {
    usersInformation += "\n" + (userArray.getUserName());
    usersInformation += "\t" + (userArray[i].getUserID());
    usersInformation += "\t" + (userArray[i].getUserAddress());
    public String getUserInformation(){
    //usersInformation = userInformation.toString();
    return usersInformation;
    // The User is deleted by shifting all the above users one place down
    private void decreaseUserArray(int loc)
    userArray[loc] = userArray[userArraySize - 1];
    userArray[userArraySize - 1] = null;
    userArraySize--;
    // This method increase the size of the array by 50%
    private void expandUserArray( )
    int newSize = (int) (userArray.length * increasePercentage);
    User newUserArray[] = new User[newSize];
    for (int i = 0; i < userArray.length; i++) {
    newUserArray[i] = userArray[i];
    userArray = newUserArray;
    Is there anything wrong with my arrays??? Here is part of my code for action performed:
    void addUserButton_actionPerformed(ActionEvent e) {
    newUserName = userNameTextField.getText();
    newUserAddress = userAdressTextField.getText();
    newUserID = Integer.parseInt ( userIDTextField.getText());
    User newUser = new User (newUserName, newUserAddress, newUserID);
    Users users = new Users();
    users.addUser(newUser);
    clearButton();
    void displayUsersButton_actionPerformed(ActionEvent e) {
    Users users = new Users();
    users.displayUsers();
    displayUsersTextArea.append (users.getUserInformation());
    void deleteUserButton_actionPerformed(ActionEvent e) {
    //Still incomplete
    Thanks for your help!

    First, PLEASE USE THE SPECIAL TOKENS FOUND AT
    http://forum.java.sun.com/faq.jsp#messageformat WHEN
    POSTING CODE!!!! Sorry about that, Iam new and I did'nt know about Special Tokens.
    As far as the problem, let me start out by asking if
    you've considered using a class that implements the
    List interface. Perhaps Vector or ArrayList would
    make a better choice since they already handle
    "growing" and "shrinking" for you.I tried using vector arrays but it got too complicated. It was very easy to add and remove objects from the vector but I never figured out how to display all the objects with all the data.
    public void displayUsers( ){
    for (int i = 0; i < userArraySize; i++) {
    usersInformation += "\n" +
    " + (userArray.getUserName());   //what is
    usersInformation?  Also, how does getUserName(),
    getUserID(), getUserAddress() know which user object
    to operate on if these are methods of userArray?
    usersInformation += "\t" +
    " + (userArray.getUserID());     //I'm guess you've
    only posted "some" of your code. 
    usersInformation += "\t" +
    " + (userArray.getUserAddress());//Try posting all
    that you have so far, and please use the special
    tokens to format your code.
    }I made a mistake while I was cutting & pasting my code. It should be for example:
    usersInformation += "\n" (userArray.getUserName());
    The comment about instanciating a new Users for each
    actionPerformed is on point. You are replacing your
    Usres with a new object each time.Yep this was the problem. I just changed the constructor, declared and
    created object of Users elsewhere.
    Thanks for your help!

  • New to Java and need help with this program..please!

    I'd really appreciate any helpful comments about this program assignment that I have to turn in a week from Friday. I'm taking a class one night a week and completely new to Java. I'd ask my professor for help, but we can't call him during the week and he never answers e-mails. He didn't tell us how to call from other classes yet, and I just can't get the darn thing to do what I want it to do!
    The assignment requirements are:
    1. Change a card game application that draws two cards
    and the higher card wins, to a Blackjack application
    2. Include a new class called Hand
    3. The Hand class should record the number of draws
    4. The application should prompt for a number of draws
    5. The game is played against the Dealer
    6. The dealer always draws a card if the dealer's hand total is <= 17
    7. Prompt the player after each hand if he wants to quit
    8. Display the total games won by the dealer and total and the total games wond by the player after each hand
    9. Display all of the dealer's and player's cards at the
    end of each hand
    10. Player has the option of drawing an additional card after the first two cards
    11. The Ace can have a value of 11 or 1
    (Even though it's not called for in the requirements, I would like to be able to let the Ace have a value of 1 or an 11)
    The following is my code with some comments about a few things that are driving me nuts:
    import java.util.*;
    import javax.swing.*;
    import java.text.*;
    public class CardDeck
    public CardDeck()
    deck = new Card[52];
    fill();
    shuffle();
    public void fill()
    int i;
    int j;
    for (i = 1; i <= 13; i++)
    for (j = 1; j <= 4; j++)
    deck[4 * (i - 1) + j - 1] = new Card(i, j);
    cards = 52;
    public void shuffle()
    int next;
    for (next = 0; next < cards - 1; next++)
    int rand = (int)(Math.random()*(next+1));
    Card temp = deck[next];
    deck[next] = deck[rand];
    deck[rand] = temp;
    public final Card draw()
    if (cards == 0)
    return null;
    cards--;
    return deck[cards];
    public int changeValue()
    int val = 0;
    boolean ace = false;
    int cds;
    for (int i = 0; i < cards; i++)
    if (cardValue > 10)
    cardValue = 10;
    if (cardValue ==1)     {
    ace = true;
    val = val + cardValue;
    if ( ace = true && val + 10 <= 21 )
    val = val + 10;
    return val;
    public static void main(String[] args)
    CardDeck d = new CardDeck();
    int x = 3;
    int i;
    int wins = 1;
    int playerTotal = 1;
    do {
    Card dealer = (d.draw());
    /**I've tried everything I can think of to call the ChangeValue() method after I draw the card, but nothing is working for me.**/
    System.out.println("Dealer draws: " + dealer);
    do {
    dealer = (d.draw());
    System.out.println(" " + dealer);
    }while (dealer.rank() <= 17);
    Card mine = d.draw();
    System.out.println("\t\t\t\t Player draws: "
    + mine);
    mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
    do{
    String input = JOptionPane.showInputDialog
    ("Would you like a card? ");
    if(input.equalsIgnoreCase("yes"))
         mine = d.draw();
    System.out.println("\t\t\t\t\t\t" + mine);
         playerTotal++;
         else if(input.equalsIgnoreCase("no"))
    System.out.println("\t\t\t\t Player stands");
         else
    System.out.println("\t\tInvalid input.
    Please try again.");
    I don't know how to go about making and calling a method or class that will combine the total cards delt to the player and the total cards delt to the dealer. The rank() method only seems to give me the last cards drawn to compare with when I try to do the tests.**/
    if ((dealer.rank() > mine.rank())
    && (dealer.rank() <= 21)
    || (mine.rank() > 21)
    && (dealer.rank() < 22)
    || ((dealer.rank() == 21)
    && (mine.rank() == 21))
    || ((mine.rank() > 21)
    && (dealer.rank() <= 21)))
    System.out.println("Dealer wins");
    wins++;
         else
    System.out.println("I win!");
    break;
    } while (playerTotal <= 1);
    String stop = JOptionPane.showInputDialog
    ("Would you like to play again? ");
    if (stop.equalsIgnoreCase("no"))
    break;
    if (rounds == 5)
    System.out.println("Player wins " +
    (CardDeck.rounds - wins) + "rounds");
    } while (rounds <= 5);
    private Card[] deck;
    private int cards;
    public static int rounds = 1;
    public int cardValue;
    /**When I try to compile this nested class, I get an error message saying I need a brace here and at the end of the program. I don't know if any of this code would work because I've tried adding braces and still can't compile it.**/
    class Hand()
    static int r = 1;
    public Hand() { CardDeck.rounds = r; }
    public int getRounds() { return r++; }
    final class Card
    public static final int ACE = 1;
    public static final int JACK = 11;
    public static final int QUEEN = 12;
    public static final int KING = 13;
    public static final int CLUBS = 1;
    public static final int DIAMONDS = 2;
    public static final int HEARTS = 3;
    public static final int SPADES = 4;
    public Card(int v, int s)
    value = v;
    suit = s;
    public int getValue() { return value; }
    public int getSuit() { return suit;  }
    public int rank()
    if (value == 1)
    return 4 * 13 + suit;
    else
    return 4 * (value - 1) + suit;
    /**This works, but I'm confused. How is this method called? Does it call itself?**/
    public String toString()
    String v;
    String s;
    if (value == ACE)
    v = "Ace";
    else if (value == JACK)
    v = "Jack";
    else if (value == QUEEN)
    v = "Queen";
    else if (value == KING)
    v = "King";
    else
    v = String.valueOf(value);
    if (suit == DIAMONDS)
    s = "Diamonds";
    else if (suit == HEARTS)
    s = "Hearts";
    else if (suit == SPADES)
    s = "Spades";
    else
    s = "Clubs";
    return v + " of " + s;
    private int value; //Value is an integer, so how can a
    private int suit; //string be assigned to an integer?
    }

    Thank you so much for offering to help me with this Jamie! When I tried to call change value using:
    Card dealer = (d.changeValue());
    I get an error message saying:
    Incompatible types found: int
    required: Card
    I had my weekly class last night and the professor cleared up a few things for me, but I've not had time to make all of the necessary changes. I did find out how toString worked, so that's one question out of the way, and he gave us a lot of information for adding another class to generate random numbers.
    Again, thank you so much. I really want to learn this but I'm feeling so stupid right now. Any help you can give me about the above error message would be appreciated.

  • I need help with a simple task (PLEASE HELP)

    hi, you know how you can make a button and link it to a
    different site with the actionscript in this program? well I need
    to know of a way like...to make a button and...link it to the next
    frame. ok, heres what im trying to make happen...the user presses a
    button in the flash program thing and a comment apperars. then they
    press it another time and a new one come up...and so on...I could
    make like 50 different frames with new comments on them and then
    make the button on each frame link to the next frame. is there a
    way to do that? if there is I REALLY need your help. please
    thanks :)

    no need to modify anything - look at the first code:
    on (release) {
    nextFrame();
    that's all you need on the button.
    If you want it to happen on click and not release:
    on (press) {
    nextFrame();
    --> **Adobe Certified Expert**
    --> www.mudbubble.com
    --> www.keyframer.com
    mybluehair wrote:
    > thank you so much. this will really help me. and, is
    there any way I can modify
    > that script so that its when the mouse is click, and not
    the arrow keys?
    >
    >
    >
    >
    quote:
    Originally posted by:
    Newsgroup User
    > on (release) {
    > nextFrame();
    > }
    >
    > from the help docs (F1):
    >
    > nextFrame function
    > nextFrame() : Void
    >
    > Sends the playhead to the next frame.
    >
    > Availability: ActionScript 1.0; Flash Player 2
    >
    > Example
    > In the following example, when the user presses the
    Right or Down arrow key,
    > the playhead goes to
    > the next frame and stops. If the user presses the Left
    or Up arrow key, the
    > playhead goes to the
    > previous frame and stops. The listener is initialized to
    wait for the arrow
    > key to be pressed, and
    > the init variable is used to prevent the listener from
    being redefined if the
    > playhead returns to
    > Frame 1.
    >
    > stop();
    >
    > if (init == undefined) {
    > someListener = new Object();
    > someListener.onKeyDown = function() {
    > if (Key.isDown(Key.LEFT) || Key.isDown(Key.UP)) {
    > _level0.prevFrame();
    > } else if (Key.isDown(Key.RIGHT) ||
    Key.isDown(Key.DOWN)) {
    > _level0.nextFrame();
    > }
    > };
    > Key.addListener(someListener);
    > init = 1;
    > }
    >
    >
    >
    > ******************************************
    > --> **Adobe Certified Expert**
    > --> www.mudbubble.com
    > --> www.keyframer.com
    >
    >
    >
    >
    > mybluehair wrote:
    > > hi, you know how you can make a button and link it
    to a different site with
    > the
    > > actionscript in this program? well I need to know
    of a way like...to make a
    > > button and...link it to the next frame. ok, heres
    what im trying to make
    > > happen...the user presses a button in the flash
    program thing and a comment
    > > apperars. then they press it another time and a new
    one come up...and so
    > on...I
    > > could make like 50 different frames with new
    comments on them and then make
    > the
    > > button on each frame link to the next frame. is
    there a way to do that? if
    > > there is I REALLY need your help. please
    > >
    > > thanks :)
    > >
    >
    >
    >
    >

  • Help with Inventory Program Buttons & images

    I'm supposed to have buttons that move between the items in my program individually showing them one by one and also going to the first item when the last one is reached and vice versa, but I cannot get the buttons to to show even show up. I'm also having problems getting any type of image to show up. Any help on this would be appreciated.
    My code is below
    import java.awt.GridLayout;
    import java.text.NumberFormat;
    import java.util.Arrays;
    import javax.swing.*;
    //Begin Main
    public class InventoryProject {
              @SuppressWarnings("unchecked")
              public static Product[] sortArray(Product myProducts[])
                   //Comparator comparator = null;
                   ProductComparator comparator = new ProductComparator();
                   Arrays.sort(myProducts, comparator);
                   return myProducts;
              public static double CalculateInventory(Product myProducts[])
                    double total = 0;
                 for (int i = 0; i < myProducts.length; i++)
                    total += myProducts.calculateInventory();
         return total;
         public static void main (String[] args) {
                   Product products[] = new Product.Supplier[5];
                   //Create 5 Product Objects
                   Product.Supplier invItem0 = new Product.Supplier("The Matrix (DVD)", 100001, 12, 15.99, "Warner Brothers");
                   Product.Supplier invItem1 = new Product.Supplier("The Matrix Reloaded (DVD)", 100002, 9, 17.99, "Warner Brothers");
                   Product.Supplier invItem2 = new Product.Supplier("The Matrix Revolutions (DVD)", 100003, 27, 18.99, "Warner Brothers");
                   Product.Supplier invItem3 = new Product.Supplier("300 (DVD)", 100004, 5, 18.99, "Warner Brothers");
                   Product.Supplier invItem4 = new Product.Supplier("Harry Potter and the Sorcerers Stone (DVD)", 100005, 10, 15.99, "Warner Brothers");
                   //products array
                   products[0] = invItem0;
                   products[1] = invItem1;
                   products[2] = invItem2;
                   products[3] = invItem3;
                   products[4] = invItem4;
                   products = sortArray(products);
                   // Output Product Object
    JTextArea textArea = new JTextArea();
    for (int a = 0; a < products.length; a++)
    textArea.append(products[a]+"\n");
    textArea.append("\nTotal value of the inventory is "+new java.text.DecimalFormat("$0.00").format(CalculateInventory(products))+"\n\n");
    JButton prevBtn = new JButton("Previous");
    prevBtn.setEnabled(false);
    JButton nextBtn = new JButton("Next");
    JPanel p = new JPanel(new GridLayout(1,2));
    p.add(prevBtn); p.add(nextBtn);
    JFrame frame = new JFrame();
    frame.getContentPane().add(new JScrollPane(textArea));
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("DVD Inventory");
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    /*          for (int a = 0; a < products.length; a++)
                        System.out.println(products[a]); //use the toString method that you have defined in your Product class to print out the product information.
                   System.out.println("Total Value of The Inventory: " + nf.format (CalculateInventory(products)));
         private String name;
         private int number;
         private int unitCount;
         private double unitPrice;
    //     public String SupplierName;
    //     public static double calculateInventory;
         //Constructor
         public Product (String name, int number, int unitCount, double unitPrice)
              setName(name);
              setNumber(number);
              setUnitCount(unitCount);
              setUnitPrice(unitPrice);
    //     get and set methods for Number attribute
         public void setNumber(int itemnumber){
              number = itemnumber;
         public int getNumber(){
              return number;
    //     get and set methods for Name attribute
         public void setName(String names){
              name = names;
         public String getName(){
              return name;
    //     get and set methods for UnitCount attribute
         public void setUnitCount(int count){
              unitCount = count;
         public int getUnitCount(){
              return unitCount;
    //     get and set methods for UnitPrice attribute
         public void setUnitPrice(double price){
              unitPrice = price;
         public double getUnitPrice(){
              return unitPrice;
    //     get and set Total Inventory method
         public double calculateInventory()
              return getUnitPrice() * getUnitCount();
         public String toString () {
              return "Item Name: " + name + "\n" + "Item Inventory Number: " + number + "\n" + "Item Unit Count: " + unitCount + "\n" + "Item Unit Price: " + unitPrice + "\n" ;
         public void Supplier() {
              // TODO Auto-generated method stub
              return;
    //     public Supplier getSupplierName() {
    //     // TODO Auto-generated method stub
    //     return null;
         static class Supplier extends Product
              //private double restockFee;
              private String supplierName;
              NumberFormat nf = NumberFormat.getCurrencyInstance();
              public Supplier(String Name, int Number, int UnitCount, double UnitPrice, String SupplierName)
                   super(Name, Number, UnitCount, UnitPrice);
                   setSupplierName(SupplierName);
                   //setRestockFee(restockFee);
                   this.supplierName = SupplierName;
              //get and set methods for Supplier attribute
              public String setSupplierName(String supplier)
                   supplierName = supplier;
                   return supplierName;
              public String getSupplierName()
                   return supplierName;
              public double calculateRestockFee()
                   return (((getUnitPrice()) * (getUnitCount())) * 0.05);
              public double calculateInventory()
                   return ((getUnitPrice() * getUnitCount()));
              public String toString ()
                   return "Item Name: " + getName() + "\n" + "Item Inventory Number: " + getNumber() + "\n" + "Item Unit Count: " + getUnitCount()
                        + "\n" + "Item Unit Price: " + nf.format(getUnitPrice()) + "\n" + "Inventory Value: " + nf.format(calculateInventory()) + "\n"
                        + "Supplier Name: " + getSupplierName() + "\n" + "Restock Fee: " + nf.format(calculateRestockFee()) + "\n";
         public int compareTo(Product arg0)
              // TODO Auto-generated method stub
              return (this.name.compareTo(arg0.getName()));
    }public class ProductComparator implements java.util.Comparator
         public int compare(Object o1, Object o2)
                   if(o1 == null) return -1;
                   if(o2 == null) return 1;
                   Product p1 = (Product) o1;
                   Product p2 = (Product) o2;
                   String s1 = p1.getName();
                   String s2 = p2.getName();
                   int compVal = s1.compareTo(s2);
                   return compVal;

    The program does work because I can get the content of my array to show in a GUI the only problem is the buttons aren't showing up in the GUI which is what I'm having a problem with. I also tried adding the panel to the frame but it didn't do any good either so maybe I'm not doing it right although when I compile I get 0 errors. What's the link to the swing tutorial?
            JTextArea textArea = new JTextArea();
            for (int a = 0; a < products.length; a++)
                textArea.append(products[a]+"\n");
            textArea.append("\nTotal value of the inventory is "+new java.text.DecimalFormat("$0.00").format(CalculateInventory(products))+"\n\n");
            JButton prevBtn = new JButton("Previous");
            prevBtn.setEnabled(false);
            JButton nextBtn = new JButton("Next");
            JPanel panel1 = new JPanel(new GridLayout(1,2));
            panel1.add(prevBtn); panel1.add(nextBtn);
            JFrame frame = new JFrame();
            frame.getContentPane().add(new JScrollPane(textArea));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setTitle("DVD Inventory");
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            frame.add(panel1);Edited by: Morepheus on May 20, 2009 12:55 AM
    Edited by: Morepheus on May 20, 2009 12:58 AM
    Edited by: Morepheus on May 20, 2009 1:00 AM

  • Help with Inventory Program

    Hello,
    I am new to Java programming and I need some assistance in trying to complie my program correctly. I would greatly appreciate it.
    I have started my program, but keep getting the same two compile errors.
    C:\Program Files\Java\Product.java:91: illegal start of expression
    public InventoryPart1(String name, double number, double units, double price)
    ^
    C:\Program Files\Java\Product.java:113: class, interface, or enum expected
    }//end class InventoryPart1
    My assignment ask:
    Choose a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD movies, or software).
    Create a product class that holds the item number, the name of the product, number of units in stock and the price of each unit.
    Create a Java application that displays the product number, the name of the product, number of units in stock, the price of each unit, and the value of inventory (the number of units multiplied by price of each unit). Pay attention to the good programming practices in the text to ensure your source code is readable and well documented.
    This is what I have so far.
    * Product.java
    * @author Amy Summers
    * A class created as a Product
    * which hold information with a constructor
    //Create and manipulate a Product class.
    import java.util.Scanner;//program uses Scanner
    class Product
    private String nameIn;
    private double numberIn;//item number
    private double unitsIn;//number of units in stock
    private double priceIn;//price of each unit
         //four-argument constructor
    public Product( String nameIn, double numberIn,
    double unitsIn, double priceIn )
    //implicit call to Object constructor occurs here
         nameIn = nameIn;
         numberIn = numberIn;
         unitsIn = unitsIn;
         priceIn = priceIn;
              }//end four-argument Product constructor
              // set product name
              public void setNameIn (String name)
    name = nameIn;
              }//end method setNameIn
              //return product name
              public String getNameIn()
         return nameIn;
              }//end method getNameIn
              // set number
              public void setNumberIn (double number)
              number = numberIn;
              }//end method setNumberIn
              //return number
              public double getNumberIn()
         return numberIn;
              }//end method getNumberIn
                   //set units
                   public void setUnitsIn ( double units)
                   units = unitsIn;
                   }//end method setUnitsIn
                   //return units
                   public double getUnitsIn()
                   return unitsIn;
                   }//end method getUnitsIn
                   //set price
                   public void setPriceIn (double price)
                   price = priceIn;
                   }//end method set priceIn
                   //return price
                   public double getPriceIn()
                   return priceIn;
                   }//end method getPriceIn               
    }//end class Product
    * InventoryPart1.java
    * @author Amy Summers
    public class InventoryPart1
         private String Productname;//product name for this
    InventoryPart1     
         //constructor initializes productName
         public InventoryPart1(String name, double number,
    double units, double price)
              Product myProduct1 = new Product
    ();//initializes productName
                   System.out.printf("%s%s\n", "Name",
                   getnameIn() );//display name
                   System.out.printf("%s%
    s\n", "Number",
                   getnumberIn() );//display number
                   System.out.printf("%s%s\n", "Units",
                   getunitsIn() );//display units
                   System.out.printf("$%.2f\n", "Price",
                   getpriceIn() );//display price
                   value = unitsIn * priceIn;//mulitple
    numbers
                   System.out.printf("$%.2f\n",
    value);//display inventory value
         }//end main method
    }//end class InventoryPart1

    * Product.java
    * @author Amy Summers
    * A class created as a Product
    * which hold information with a constructor
    //Create and manipulate a Product class.
    import java.util.Scanner;//program uses Scanner
    class Product
          private String nameIn;
          private double numberIn;//item number
          private double unitsIn;//number of units in stock
          private double priceIn;//price of each unit
           //four-argument constructor
        public Product( String nameIn, double numberIn, double unitsIn, double priceIn )
                //implicit call to Object constructor occurs here
                     nameIn = nameIn;
                     numberIn = numberIn;
                     unitsIn = unitsIn;
                     priceIn = priceIn;
                    }//end four-argument Product constructor
                    // set product name
                    public void setNameIn (String name)
                name = nameIn;
                   }//end method setNameIn
                   //return product name
                    public String getNameIn()
                    return nameIn;
                    }//end method getNameIn
                    // set number
                    public void setNumberIn (double number)
                  number = numberIn;
                    }//end method setNumberIn
                     //return number
                    public double getNumberIn()
                    return numberIn;
                   }//end method getNumberIn
                   //set units
                   public void setUnitsIn ( double units)
                   units = unitsIn;
                   }//end method setUnitsIn
                   //return units
                   public double getUnitsIn()
                   return unitsIn;
                   }//end method getUnitsIn
                   //set price
                   public void setPriceIn (double price)
                   price = priceIn;
                   }//end method set priceIn
                   //return price
                   public double getPriceIn()
                   return priceIn;
                   }//end method getPriceIn               
    }//end class Product
    * InventoryPart1.java
    * @author Amy Summers
    public class InventoryPart1
         private String Productname;//product name for this InventoryPart1     
         //constructor initializes productName
         public InventoryPart1(String name, double number, double units, double price)
              Product myProduct1 = new Product();//initializes productName
                   System.out.printf("%s%s\n", "Name",
                   getnameIn() );//display name
                   System.out.printf("%s%s\n", "Number",
                   getnumberIn() );//display number
                   System.out.printf("%s%s\n", "Units",
                   getunitsIn() );//display units
                   System.out.printf("$%.2f\n", "Price",
                   getpriceIn() );//display price
                   value = unitsIn * priceIn;//mulitple numbers
                   System.out.printf("$%.2f\n", value);//display inventory value
         }//end main method
    }//end class InventoryPart1Sorry about that.

  • Need Help With Collection.binarySearch ! Please help me

    * TaxPayerRecord.java
    * Created on December 21, 2006, 11:42 AM
    public class TaxPayerRecord implements Comparable <TaxPayerRecord>
        private String nric;
        private String name;
        private String dateOfBirth;
        private String gender;
        private String blockNo;
        private String unitNo;
        private String streetName;
        private String bldgName;
        private String postalCode;
        private long totalIncome;
        private long totalDonation;
        private long totalPersonalRelief;
         * Creates a new instance of TaxPayerRecord
        public TaxPayerRecord(String nric, String name, String dateOfBirth, String gender,
                                 String blockNo, String unitNo, String streetName, String bldgName,
                                 String postalCode, long totalIncome, long totalDonation,
                                 long totalPersonalRelief)
            this.nric = nric;
            this.name = name;
            this.dateOfBirth = dateOfBirth;
            this.gender = gender;
            this.blockNo = blockNo;
            this.unitNo = unitNo;
            this.streetName = streetName;
            this.bldgName = bldgName;
            this.postalCode = postalCode;
            this.totalIncome = totalIncome;
            this.totalDonation = totalDonation;
            this.totalPersonalRelief = totalPersonalRelief;
        public String toString()
            return nric+"|"+name+"|"+dateOfBirth+"|"+gender+"|"+blockNo+"|"+unitNo+"|"+streetName+"|"+
                   bldgName+"|"+postalCode+"|"+totalIncome+"|"+totalDonation+"|"+
                   totalPersonalRelief;
        public long getTotalIncome()
            return totalIncome;
        public long getTotalDonation()
            return totalDonation;
        public long getTotalPersonalRelief()
            return totalPersonalRelief;
        public String getDateOfBirth()
            return dateOfBirth;
        public String getPostalCode()
            return postalCode;
        public int compareTo (TaxPayerRecord next)
              return this.nric.compareTo(next.nric);
    } //TaxPayerRecord
    import java.io.*;
    import java.util.*;
    public class TaxPayerProgramme
         public TaxPayerProgramme()
                             String menu = "Options: \n"
                                            + "1. Compute And Print List Of Tax Payers (Sorted by NRIC) \n"
                                            + "2. Compute And Summary Of Tax Revenue \n"
                                            + "3. Search for Tax Payer by NRIC \n"
                                            + "Enter option(1-2,0 to quit): ";
                             System.out.print(menu);
                             Scanner input = new Scanner( System.in );
                             int choice = input.nextInt();
                             System.out.println("");
                         // Declaration
                             ArrayList<TaxPayerRecord> list = new ArrayList<TaxPayerRecord>();
                             String inFile ="TaxPayer2005.txt";
                             String line = "";
                             String nric;
                             String name;
                             String dateOfBirth;
                             String gender;
                             String blockNo;
                             String unitNo;
                             String streetName;
                             String bldgName;
                             String postalCode;
                             long totalIncome;
                             long totalDonation;
                             long totalPersonalRelief;
                        try{
                             //Read from file
                             FileReader fr = new FileReader (inFile);
                             BufferedReader inFile1= new BufferedReader (fr);
                             line=inFile1.readLine();
                                       while (line!=null)
                                       StringTokenizer tokenizer = new StringTokenizer(line,"|");
                                       nric=tokenizer.nextToken();
                                       name=tokenizer.nextToken();
                                       dateOfBirth=tokenizer.nextToken();
                                       gender=tokenizer.nextToken();
                                       blockNo=tokenizer.nextToken();
                                       unitNo=tokenizer.nextToken();
                                       streetName=tokenizer.nextToken();
                                       bldgName=tokenizer.nextToken();
                                       postalCode=tokenizer.nextToken();
                                       totalIncome=Long.parseLong(tokenizer.nextToken());
                                       totalDonation=Long.parseLong(tokenizer.nextToken());
                                       totalPersonalRelief=Long.parseLong(tokenizer.nextToken());
                                       TaxPayerRecord person = new TaxPayerRecord(nric,name,dateOfBirth,gender,blockNo,unitNo,
                                                                                              streetName,bldgName,postalCode,totalIncome,
                                                                                              totalDonation,totalPersonalRelief);
                                       list.add(person);
                                       line=inFile1.readLine();
                                       }//end while
                              inFile1.close();
                             }// end try
                        catch (Exception e)
                              e.printStackTrace();
                        }//end catch
                        do{
                                  switch(choice)
                                       case 0:
                                       System.exit(0);
                                       break;
                                       case 1:
                                       // run list
                                       printList(list);
                                       break;
                                       case 2:
                                       printSummary(list);
                                       break;
                                       case 3:
                                       search(list,input);
                                       break;
                                  }//end switch
                             System.out.print(menu);
                             choice = input.nextInt();
                             System.out.println("");
                             }// end do
                             while(choice !=0);
                             Collections.sort(list);
         }//end TaxPayerProgramme()
         private void total(ArrayList<TaxPayerRecord> list)
              // Declaration
              double total=0;
              // calculate total
                   for (int i=0; i<list.size(); i++)
                   total=+ tax(i,list);
              //print msg
              System.out.println("Total revenue collectable for year 2006 (S$): "+total+"\n");
         private double tax(int i,ArrayList<TaxPayerRecord> list)
              // Declaration
              double income;
              double tax;
              // calculate income
              income =list.get(i).getTotalIncome()-list.get(i).getTotalDonation()
                        -list.get(i).getTotalPersonalRelief();
              // calculate tax
                   if (income>320000)
                        tax=(((income-320000)*0.21)+44850);
                   else if (income>160000)
                        tax=(((income-160000)*0.18)+16050);
                   else if (income>80000)
                        tax=(((income-80000)*0.145)+4450);
                   else if (income>40000)
                        tax=(((income-40000)*0.0875)+950);
                   else if (income>30000)
                        tax=(((income-30000)*0.0577)+375);
                   else
                        tax=((income-20000)*0.0577);
              return tax;
         private void totalAge(ArrayList<TaxPayerRecord> list)
                   // Declaration
                   String msg;
                   int i,age;
                   double grp1=0;
                   double grp2=0;
                   double grp3=0;
                   double grp4=0;
                   // calculate revenue by age
                        for (i=0; i<list.size(); i++)
                        age= 2006- Integer.parseInt(list.get(i).getDateOfBirth().substring(6,list.get(i).getDateOfBirth().length()));
                        if (age>55)
                             grp4 =+ tax(i,list);
                        else if (age>35)
                             grp3 =+ tax(i,list);
                        else if (age>17)
                             grp2 =+ tax(i,list);
                        else
                             grp1 =+ tax(i,list);
                   //print msg
                   msg="Total revenue by age range (S$) \n"+
                        "\t"+"(1 to 17)"+"\t"+ grp1 +"\n"     +
                        "\t"+"(18 to 35)"+"\t"+ grp2 +"\n"     +
                        "\t"+"(36 to 55)"+"\t"+ grp3 +"\n"     +
                        "\t"+"(above 55)"+"\t"+ grp4 +"\n";
                   System.out.println(msg);
        private void totalDistrict(ArrayList<TaxPayerRecord> list)
                   int count=1;
                   double temp=0;
                   double [][] array = new double [list.size()][2];
                        for (int i=0; i<list.size(); i++)
                        array[0]=Double.parseDouble(list.get(i).getPostalCode().substring(0,2));
                        array[i][1]=tax(i,list);
                   System.out.println("Total revenue by district (S$) ");
                        do{
                                  for (int a=0; a<list.size(); a++)
                                       if (count == array[a][0] )
                                       temp=array[a][1];
                                  }//end for loop
                             System.out.print("\t"+"(district "+count+")"+"\t"+ temp +"\n");
                             temp=0;
                             count++;
                        }while(count!= 80);// end of do_while loop
              System.out.print("\n");
         private void printList(ArrayList<TaxPayerRecord> list)
              System.out.println("List of Tax Payers fpr Year 2006");
                   for (int i=0; i<list.size(); i++)
                   System.out.println((i+1)+") "+list.get(i)+"|"+tax(i,list)+"\n");
         private void printSummary(ArrayList<TaxPayerRecord> list)
                   total(list);
                   totalAge(list);
                   totalDistrict(list);
         private void search(ArrayList<TaxPayerRecord> list,Scanner input)
                   int value;
                   System.out.print("Enter NRIC Number: ");
                   String nric = input.next();
                   Collections.sort(list);
                   value = Collections.binarySearch(list,nric);
         public static void main(String [] args)
                   new TaxPayerProgramme();
    Can someone help me with this?
    I can't find the error.
    The error msg display:
    C:\Documents and Settings\Xiong\Desktop\TaxPayerProgramme.java:285: cannot find symbol
    symbol : method binarySearch(java.util.ArrayList<TaxPayerRecord>,java.lang.String)
    location: class java.util.Collections
                   value = Collections.binarySearch(list,nric);
                   ^
    1 error
    Tool completed with exit code 1

    Well, this is the error, Java6 gives me on your code:The method binarySearch(List< ? extends Comparable<? super T> >, T) in the type Collections
    is not applicable for the arguments (ArrayList<TaxPayerRecord>, String)     The method expects the first parameter, to be a List whose children are Comparable to the second parameter. Your second parameter is String, so the List should be on String not on TaxPayerRecord, or, your second parameter should be a TaxPayerRecord and not a String.
    �dit: Another thought. From the error code you posted, I would assume, that you might have the wrong JDK libraries in your path.

  • XML driven FLV player with playlist, can someone please help me?

    OK so ive been working for a client recently building him a new site for his racing team and he wants a video jukebox on the "videos section" of the site.
    Now i am the one with the job of updating this jukebox with new videos which he makes (this happens often) so i want updating to be as easy as possible.
    Im new to the use of XML with flash and followed a tutorial to create a dynamic Image Gallery which is really easy to update, all i have to do is drop the files into the right directories in my FTP client and edit the XML file, perfect.
    I want the jukebox to do the same thing.
    I want to have a jukebox with a "video screen" with basic controlls (play/pause, volume, rewind, seek) on the left and a small vertically scrolling menu on the right that contains thumbnails and descriptions of the videos that when clicked changes the content of the video component to play the chosen video.
    I found a tutorial on the adobe site that shows how to achive this through the use of the "video component" and the "list component" in flash 8 HOWEVER, this isnt very pretty and almost impossible to customise due to the list component and i would like to be able to mimic the style of the image gallery i already produced to keep things all nice and uniform.
    i want to use XML to point flash to the source of the FLV files, the source of the thumbnail jpgs and give the text for the description so that its easy to update and use flash's drawing interface to make it pretty.
    Basically i want to reproduce something like this.
    Ive been searching for weeks now and i cant find anything to help me with this, if anyone knows of any tutorials, books, videos or has any idea how to help me it would be MUCH appreciated.
    Thankyou.

    Try this link:
    http://www.taiwantrade.com.tw/MAIN/en_front/searchserv.do?method=listProductComp anyDetail&company_id=163054&locale=2
    There is an email address and telephone numbers.
    Also look on the box and instructions.
    Ciao.

Maybe you are looking for

  • Can I get audio through iPhone when using apple tv?

    Can I get audio through iPhone when using apple tv?

  • Recycling a MacPro's ATI 2600 in a 2.5GHz Quad G5

    Hi there, My friend's Quad G5 has a PCI-e port and Leopard. What if I put my Mac Pro's ATI 2600 in his machine? Will it work at all? Thanks for your help.

  • Print 1099 MISC form

    All, We applied the 2008 1009 oss note. Now I'm trying to test print in T03. Once I execute the program, I went to SPA script to print the form on a plain sheet. I could to print preview.But, I'm unable create spool.  I did choose the Print form opti

  • Macbook will not let me login unless I disconeect ext. display

    I have a new, 2months old, that just stopped detecting my external display(Sony tv connected via Mini display-HDMI-TV) When I restart, I can not login unless the extra display is not connected. It just starts to login, then flashes blue like when you

  • URGENT -- Increase the buffer of the serveroutput

    Hello I would like to know if it exists any way to increase the buffer of messages in SQL*PLUS. I am testing the functions of a package (process very long) and I would like to know what happens in the middle to test it correctly. I have tried to writ