473,507 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorter not working, it worked in my previous assignment

7 New Member
Now this is really the last problem (for real now) with this assignment. My sorter is not working. I managed to sort by product name in my previous assignment; however, I can't get it to work on this one. I changed things around so much in the program that I'm lost on how to get it going again. I also blocked that part of the code off with delimiters; I didn't want it to interfere with program

Expand|Select|Wrap|Line Numbers
  1. import java.awt.BorderLayout;
  2. import java.awt.Dimension;
  3. import java.awt.FlowLayout;
  4. import java.awt.HeadlessException;
  5. import java.awt.Image;
  6.  
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9.  
  10. import java.io.File;
  11. import java.io.FileNotFoundException;
  12. import java.io.FileOutputStream;
  13. import java.io.IOException;
  14. import java.io.ObjectOutputStream;
  15. import java.io.Serializable;
  16.  
  17. import javax.swing.ImageIcon;
  18. import javax.swing.JButton;
  19. import javax.swing.JFrame;
  20. import javax.swing.JLabel;
  21. import javax.swing.JOptionPane;
  22. import javax.swing.JPanel;
  23. import javax.swing.JScrollPane;
  24. import javax.swing.JTextArea;
  25.  
  26.  
  27. public class TransformersGUIMainExecution extends JFrame implements ActionListener,Serializable 
  28. {
  29.    private JTextArea textArea;
  30.  
  31.    private JButton first,
  32.                    next,
  33.                    previous,
  34.                    last,
  35.                    add,
  36.                    modify,
  37.                    delete,
  38.                    save,
  39.                    search,
  40.                    exit;
  41.  
  42.    JLabel imageLabel;
  43.  
  44.    private static TransformersInventoryInfo inv = new TransformersInventoryInfo();
  45.  
  46.    /**
  47.      * @param arg0
  48.      * @throws HeadlessException
  49.      */
  50.    public TransformersGUIMainExecution( String arg0 ) throws HeadlessException 
  51.    {
  52.       super( "Inventory GUI" );
  53.  
  54.       textArea = new JTextArea( 250,30 );
  55.  
  56.       JScrollPane scrollPane = new JScrollPane( textArea ); 
  57.  
  58.       textArea.setEditable( false );
  59.  
  60.       scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
  61.  
  62.       scrollPane.setPreferredSize( new Dimension( 250, 250 ) );
  63.  
  64.       JPanel cp = new JPanel();
  65.  
  66.       cp.setSize( 250, 40 );
  67.  
  68.       cp.setLayout( new BorderLayout() );
  69.  
  70.       cp.add( scrollPane,BorderLayout.CENTER );
  71.  
  72.       JPanel buttonPaenl = new JPanel();
  73.  
  74.       JPanel buttonPaenl1 = new JPanel();
  75.  
  76.       first = new JButton( "First" );
  77.       first.addActionListener( this );
  78.  
  79.       search = new JButton( "Search" );
  80.       search.addActionListener( this );
  81.  
  82.       next = new JButton( "Next" );
  83.       next.addActionListener( this );
  84.  
  85.       previous = new JButton( "Previous" );
  86.       previous.addActionListener( this );
  87.  
  88.       last = new JButton( "Last" );
  89.       last.addActionListener( this );
  90.  
  91.       add = new JButton( "Add" );
  92.       add.addActionListener( this );
  93.  
  94.       modify = new JButton( "Modify" );
  95.       modify.addActionListener( this );
  96.  
  97.       delete = new JButton( "Delete" );
  98.       delete.addActionListener( this );
  99.  
  100.       save = new JButton( "Save" );
  101.       save.addActionListener( this );
  102.  
  103.       exit = new JButton( "Exit" );
  104.       exit.addActionListener( this );
  105.  
  106.       buttonPaenl.setLayout( new FlowLayout() );
  107.       buttonPaenl1.setLayout( new FlowLayout() );
  108.       buttonPaenl.add( first );
  109.       buttonPaenl.add( previous );
  110.       buttonPaenl.add( next );
  111.       buttonPaenl.add( last );
  112.       buttonPaenl1.add( add );
  113.       buttonPaenl1.add( modify );
  114.       buttonPaenl1.add( delete );
  115.       buttonPaenl1.add( save );
  116.       buttonPaenl1.add( search );
  117.       buttonPaenl1.add( exit );
  118.  
  119.       cp.add( buttonPaenl,BorderLayout.SOUTH );
  120.       cp.add( buttonPaenl1,BorderLayout.NORTH );
  121.  
  122.       ImageIcon icon = new ImageIcon( "AutobotCompanyLogo.jpg" );
  123.       imageLabel = new JLabel( icon, JLabel.CENTER );
  124.       cp.add( imageLabel, BorderLayout.EAST );
  125.       this.setContentPane( cp );
  126.  
  127.       this.setTitle( " Week Nine Final Project: Inventory Program Part Six - Transformers Autobot Inventory ( More Than Meets the Eye o_0?! ) " );
  128.  
  129.       this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  130.       this.textArea.setText(inv.getFirst());
  131.       this.setSize(400, 400);
  132.       this.pack();
  133.       this.setVisible( true );
  134.    }
  135.  
  136.    @Override
  137.    public void actionPerformed( ActionEvent e ) 
  138.    {
  139.       // TODO Auto-generated method stub
  140.       if( e.getActionCommand().equals( "First" ) )
  141.       {
  142.          textArea.setText( inv.getFirst() );
  143.       }
  144.  
  145.       if( e.getActionCommand().equals( "Next" ) )
  146.       {
  147.          textArea.setText(inv.getNext());
  148.       }
  149.  
  150.       if( e.getActionCommand().equals( "Previous" ) )
  151.       {
  152.          textArea.setText( inv.getPrevious() );
  153.       }
  154.  
  155.       if( e.getActionCommand().equals( "Last" ) )
  156.       {
  157.          textArea.setText(inv.getLast());
  158.       }
  159.  
  160.       if( e.getActionCommand().equals( "Save" ) )
  161.       {
  162.          save();
  163.       }
  164.  
  165.       if( e.getActionCommand().equals( "Exit" ) )
  166.       {
  167.          System.exit(0);
  168.       }
  169.  
  170.       if( e.getActionCommand().equals( "Add" ) ) 
  171.       {
  172.          TransformersInventoryDialogue id = new TransformersInventoryDialogue( true," Add a new Inventory " );
  173.       }
  174.  
  175.       if( e.getActionCommand().equals( "Modify" ) )
  176.       {
  177.          TransformersInventoryDialogue id = new TransformersInventoryDialogue( false," Modify Inventory " );
  178.       }
  179.  
  180.       if( e.getActionCommand().equals( "Search" ) )
  181.       {
  182.          String s = JOptionPane.showInputDialog( null, " Enter Product Name ",null, 1 );
  183.  
  184.          s = inv.Search(s);
  185.  
  186.          if( s == null )
  187.          {
  188.             JOptionPane.showMessageDialog( this, " No Results Found " ) ;
  189.          } 
  190.  
  191.          else textArea.setText( s );
  192.       }
  193.  
  194.       if( e.getActionCommand().equals( "Delete" ) )
  195.       {
  196.          inv.getproducts().remove( inv.index );
  197.       }
  198.  
  199.    }
  200.  
  201.    public void save()
  202.    {            
  203.       // Initialize object
  204.       String filepath = "C:/data";
  205.  
  206.       File myDir = new File( filepath );
  207.  
  208.       // Check if directory exists
  209.       if( !myDir.exists( ) )
  210.       {
  211.          try
  212.          {
  213.             if( !myDir.mkdirs( ) )
  214.             {
  215.                // Could not create folder(s), so end execution here
  216.             }
  217.          }
  218.          catch( SecurityException e )
  219.          {
  220.             // Error handling here
  221.          }
  222.       }      
  223.  
  224.  
  225.       File f = new File( "C:\\data\\inventory.dat" );
  226.  
  227.       try 
  228.       {  
  229.          FileOutputStream out = new FileOutputStream( f );
  230.  
  231.          try 
  232.          {
  233.             ObjectOutputStream objectOut = new ObjectOutputStream( out );
  234.                objectOut.writeObject( inv );
  235.          } 
  236.  
  237.          catch (IOException e) 
  238.          {
  239.             // TODO Auto-generated catch block
  240.             JOptionPane.showMessageDialog( null, e.getMessage() );
  241.                e.printStackTrace();
  242.          }
  243.       } 
  244.  
  245.       catch ( FileNotFoundException e ) 
  246.       {
  247.          // TODO Auto-generated catch block
  248.          JOptionPane.showMessageDialog( null, e.getMessage() );
  249.             e.printStackTrace();
  250.       }
  251.  
  252.    }  
  253.  
  254.    public static TransformersInventoryInfo getInv() 
  255.    {
  256.       return inv;
  257.    }
  258.  
  259.    public static void setInv( TransformersInventoryInfo inv ) 
  260.    {
  261.       TransformersGUIMainExecution.inv = inv;
  262.    }
  263.  
  264.    /**
  265.     * @param args
  266.     */
  267.    public static void main( String[] args ) 
  268.    {
  269.       TransformersGUIMainExecution TransformersInventoryInfo = new TransformersGUIMainExecution( "Inventory" );
  270.    }
  271. }
  272.  
Expand|Select|Wrap|Line Numbers
  1. import java.awt.BorderLayout;
  2. import java.awt.FlowLayout;
  3. import java.awt.LayoutManager;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6.  
  7. import javax.swing.BoxLayout;
  8. import javax.swing.JButton;
  9. import javax.swing.JFrame;
  10. import javax.swing.JLabel;
  11. import javax.swing.JOptionPane;
  12. import javax.swing.JPanel;
  13. import javax.swing.JTextField;
  14.  
  15.  
  16. public class TransformersInventoryDialogue extends JFrame implements ActionListener
  17. {
  18.    private boolean status = false; //false is for modify
  19.  
  20.    JTextField nameTextField,
  21.               unitTextField,
  22.               priceTextField;
  23.  
  24.    JLabel nameLabel,
  25.           unitLabel,
  26.           priceLabel;
  27.  
  28.    JPanel TextFields,
  29.           buttons;
  30.  
  31.    JButton modify, 
  32.            add;
  33.  
  34.    public TransformersInventoryDialogue( Boolean stat, String title )
  35.    {
  36.       super( title );
  37.       status = stat;
  38.       JPanel but = new JPanel();
  39.       modify = new JButton( "Modify" );
  40.       modify.addActionListener( this );
  41.       add = new JButton( "Add" );
  42.       add.addActionListener( this );
  43.       but.add( add );
  44.       but.add( modify );
  45.  
  46.       if( status == false )
  47.       {
  48.          add.setVisible( false );
  49.       }
  50.  
  51.       else
  52.       {
  53.          modify.setVisible( false );
  54.       }
  55.  
  56.       nameTextField = new JTextField( "", 20 );
  57.       unitTextField = new JTextField( "", 5 );
  58.       priceTextField = new JTextField( "" , 5 );
  59.       nameLabel = new JLabel( "Name" );
  60.       unitLabel = new JLabel( "Units" );
  61.       priceLabel = new JLabel( "Price per Unit" );
  62.       JPanel p = new JPanel();
  63.  
  64.       p.setLayout( new FlowLayout() );
  65.       p.add( nameLabel );
  66.       p.add( nameTextField );
  67.       p.add( unitLabel );
  68.       p.add( unitTextField );
  69.       p.add( priceLabel );
  70.       p.add( priceTextField );
  71.       JPanel cp = new JPanel();
  72.       cp.setLayout( new BorderLayout() );
  73.       cp.add( p, BorderLayout.CENTER );
  74.       cp.add( but, BorderLayout.EAST );
  75.       this.setContentPane( cp );
  76.       this.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
  77.       this.pack();
  78.       this.setVisible( true );
  79.    }
  80.  
  81.    @Override
  82.    public void actionPerformed( ActionEvent arg0 ) 
  83.    {
  84.       if( arg0.getActionCommand().equals( "Add" ) )
  85.       {
  86.          String name;
  87.          int units;
  88.          Double price;
  89.          name = nameTextField.getText();
  90.  
  91.          try 
  92.          {
  93.             units = Integer.parseInt( unitTextField.getText() );
  94.          } 
  95.  
  96.          catch ( NumberFormatException e ) 
  97.          {
  98.             JOptionPane.showMessageDialog( null, "Please Enter Valid Integers" );
  99.  
  100.             e.printStackTrace();
  101.  
  102.             return;
  103.          }
  104.  
  105.          try 
  106.          {
  107.             price = Double.parseDouble( priceTextField.getText() );
  108.          } 
  109.  
  110.          catch ( NumberFormatException e ) 
  111.          {
  112.             // TODO Auto-generated catch block
  113.             JOptionPane.showMessageDialog( null, "Please Enter Valid Price" );
  114.  
  115.             e.printStackTrace();
  116.  
  117.             return;
  118.          }
  119.  
  120.          TransformersGUIMainExecution.getInv().getproducts().add( new TransformersSubProduct( name, TransformersGUIMainExecution.getInv().products.size(), 
  121.                                                                        units,price ) );
  122.  
  123.          this.dispose();
  124.       }
  125.  
  126.       if( arg0.getActionCommand().equals( "Modify" ) )
  127.       {
  128.          String name;
  129.          int units;
  130.          Double price;
  131.          name = nameTextField.getText();
  132.  
  133.          try 
  134.          {
  135.             units = Integer.parseInt( unitTextField.getText() );
  136.          } 
  137.  
  138.          catch ( NumberFormatException e ) 
  139.          {
  140.             JOptionPane.showMessageDialog( null,"Please Enter Valid Integers" );
  141.  
  142.             e.printStackTrace();
  143.  
  144.             return;
  145.          }
  146.  
  147.          try 
  148.          {
  149.             price = Double.parseDouble( priceTextField.getText() );
  150.          } 
  151.  
  152.          catch ( NumberFormatException e ) 
  153.          {
  154.             // TODO Auto-generated catch block
  155.             JOptionPane.showMessageDialog( null,"Please Enter Valid Price" );
  156.  
  157.             //e.printStackTrace();
  158.             return;
  159.          }
  160.  
  161.          TransformersGUIMainExecution.getInv().getproducts().set( TransformersGUIMainExecution.getInv().index, 
  162.             new TransformersSubProduct( name, TransformersGUIMainExecution.getInv().index, units, price ) );
  163.  
  164.          this.dispose();
  165.       }
  166.  
  167.    }
  168.  
  169.    public static void main( String args[] )
  170.    {
  171.       TransformersInventoryDialogue idf = new TransformersInventoryDialogue( true,"cc" );
  172.    }
  173. }
  174.  
Expand|Select|Wrap|Line Numbers
  1. import java.text.Collator;
  2. import java.util.ArrayList;
  3. import java.util.Iterator;
  4. import java.util.Locale;
  5. import java.io.Serializable;
  6.  
  7. public class TransformersInventoryInfo implements Serializable
  8. {
  9.    //private String inventoryName; // name of inventory
  10.  
  11.    //public String restockRate; // restock rate percentage
  12.  
  13.    //public double totalRestock;
  14.  
  15.    public static int index;
  16.  
  17.    public ArrayList < TransformersSubProduct > products = new ArrayList < TransformersSubProduct > ();
  18.  
  19.    public TransformersInventoryInfo()
  20.    {
  21.       products.add( new TransformersSubProduct( "No Sale Bot",    0,   1,   0.00 ) );
  22.       products.add( new TransformersSubProduct( "Optimus Prime",  7,  52, 160.00 ) );
  23.       products.add( new TransformersSubProduct( "BumbleeBee",    16,  61,  97.00 ) );
  24.       products.add( new TransformersSubProduct( "Ironhide",      25, 106,  88.00 ) );
  25.       products.add( new TransformersSubProduct( "Ratchet",       34, 115,  79.00 ) );
  26.       products.add( new TransformersSubProduct( "Jazz",          43, 124,  70.00 ) );
  27.  
  28.       index = 0;
  29.    }
  30.  
  31.    /*public void sort()
  32.    {
  33.       Locale loc = Locale.ENGLISH;
  34.  
  35.       ProductModified Temp;
  36.  
  37.       Collator col = Collator.getInstance( loc );
  38.  
  39.       for ( int i = 0; i < products.size(); i++ ) 
  40.       {
  41.          for ( int j = i + 1; j < products.size(); j++ )
  42.          {
  43.             if( col.compare( products.get( i ).getAutobotName(), products.get( j ).getAutobotName() ) > 0 )
  44.             {
  45.                Temp = products.get( i );
  46.  
  47.                products.set( i, products.get( j ) );
  48.                products.set( j, Temp );
  49.             }
  50.          }
  51.       }
  52.    }
  53.  
  54.    /*public String getInventoryName() 
  55.    {
  56.       return inventoryName;
  57.    }
  58.  
  59.     public void setInventoryName( String inventoryName ) 
  60.     {
  61.        this.inventoryName = inventoryName;
  62.     }
  63.  
  64.     public String getRestockRate() 
  65.     {
  66.        return restockRate;
  67.     }
  68.  
  69.     public void setRestockRate( String restockRate ) 
  70.     {
  71.        this.restockRate = restockRate;
  72.     }
  73.  
  74.     public double getTotalRestock() 
  75.     {
  76.        return totalRestock;
  77.     }
  78.  
  79.     public void setTotalRestock( double totalRestock ) 
  80.     {
  81.        this.totalRestock = totalRestock;
  82.     }*/
  83.  
  84.     public ArrayList < TransformersSubProduct > getproducts() 
  85.     {
  86.        return products;
  87.     }
  88.  
  89.     public void seproducts( ArrayList < TransformersSubProduct > products) 
  90.     {
  91.        this.products = products;
  92.     }
  93.  
  94.     /*public String toString()
  95.     {
  96.        String transformersSub = new String(" ");
  97.  
  98.        transformersSub = "Welcome to the\n" + getInventoryName() + "!\n\n";
  99.  
  100.        transformersSub = transformersSub + "Below is the available inventory:\n\n";
  101.  
  102.        transformersSub = transformersSub + "The restock interest rate is at " + getRestockRate() + ".\n\n";
  103.  
  104.        transformersSub = transformersSub + "Index\tProductModified #\t\t\tName\t\tUnits\t\tPrice\t\t";
  105.  
  106.        transformersSub = transformersSub + "Unit Restock Value\t";    
  107.  
  108.        transformersSub = transformersSub + "Stock Value\t\t";
  109.  
  110.        transformersSub = transformersSub + "Total ProductModified Restock\n";
  111.  
  112.        Iterator < ProductModified > i = this.getproducts().iterator();
  113.  
  114.        while(i.hasNext())
  115.        {
  116.           transformersSub = transformersSub + i.next();
  117.        }
  118.  
  119.       return transformersSub;
  120.    }*/
  121.  
  122.    public Double getTotal()
  123.    {
  124.       Double Total = 0.00;
  125.  
  126.       TransformersSubProduct p;
  127.  
  128.       Iterator < TransformersSubProduct > i = products.iterator();
  129.  
  130.       while( i.hasNext() )
  131.       {
  132.             p = i.next();
  133.  
  134.             Total = Total + p.getPrice() * p.getUnit();
  135.       }
  136.  
  137.       return Total;
  138.    }
  139.  
  140.    public Double getTotalRestock()
  141.    {
  142.       Double TotalRestock = 0.00;
  143.  
  144.       TransformersSubProduct p;
  145.  
  146.       Iterator < TransformersSubProduct > i = products.iterator();
  147.  
  148.       while( i.hasNext() )
  149.       {
  150.             p = i.next();
  151.  
  152.             TotalRestock = TotalRestock + ( 0.05 * p.getPrice() * p.getUnit() ) 
  153.                                         + ( p.getPrice() * p.getUnit() );
  154.       }
  155.  
  156.       return TotalRestock;
  157.    }
  158.  
  159.    public String processOutPut( TransformersSubProduct p )
  160.    {
  161.       String out = "Welcome to the Transformers Autobot Toy Inventory!" + "\n\nBelow is the available Inventory:"
  162.       + "\n\nThe restock interest rate is at 5%"   
  163.       + "\n\nItem #\tName\t\tUnits\tPrice\tUnit Restock\tStock Value\tTotal Product Restock" 
  164.       + p + "\n\nThe value of the entire inventory is $" + this.getTotal()
  165.       + "\n\nThe 5% restocking cost for the entire inventory is $" + this.getTotalRestock();
  166.  
  167.       return out;
  168.    }
  169.  
  170.    public String getFirst()
  171.    {
  172.       index = 0;
  173.  
  174.       return processOutPut( products.get(0) );
  175.  
  176.    }
  177.  
  178.    public String getLast()
  179.    {
  180.       index = products.size() - 1;
  181.  
  182.       return processOutPut( products.get( products.size() - 1 ) );
  183.    }
  184.  
  185.    public String getNext()
  186.    {
  187.       if( index == products.size() - 1 ) 
  188.       {
  189.          getFirst();
  190.  
  191.          return getFirst();
  192.       } 
  193.  
  194.       else
  195.       {
  196.          index++;
  197.  
  198.          return processOutPut( products.get( index ) );
  199.       }
  200.    }
  201.  
  202.    public String getPrevious()
  203.    {
  204.       if( index == 0 )
  205.       {
  206.          return getLast();
  207.       } 
  208.  
  209.       else
  210.  
  211.       return processOutPut(products.get(--index));
  212.    }
  213.  
  214.    public String Search( String Search )
  215.    {
  216.       Iterator < TransformersSubProduct > i = products.iterator();
  217.  
  218.       String te = null;
  219.  
  220.       TransformersSubProduct p;
  221.  
  222.       while( i.hasNext() )
  223.       {
  224.          p = i.next();
  225.  
  226.          if( p.getAutobotName().equals( Search ) )
  227.          {
  228.             te = processOutPut( p );
  229.          }
  230.       }
  231.  
  232.       return te;
  233.    }
  234. }
  235.  
  236.  
Expand|Select|Wrap|Line Numbers
  1. import static java.lang.System.out;
  2. import java.io.Serializable;
  3.  
  4. //class declaration for TransformersProduct
  5. public class TransformersProduct implements Serializable
  6. {
  7.    public String autobotName; // array of autobot toy names
  8.  
  9.    public int productNumber; // product # array ID for product
  10.    public int unit; // array of autobot toy units
  11.  
  12.    public double price; // array of autobot prices
  13.  
  14.    public double restock;
  15.    public double stock;
  16.    public double totalRestock;
  17.  
  18.    /**
  19.     * @param autobotName
  20.     * @param productNumber
  21.     * @param unit           
  22.     * @param price
  23.     */
  24.  
  25.    public TransformersProduct( String autobotName, int productNumber, int unit,
  26.                    double price ) 
  27.    {
  28.       super();
  29.       this.autobotName = autobotName;
  30.       this.productNumber = productNumber;
  31.       this.unit = unit;
  32.       this.price = price;
  33.    }
  34.  
  35.    public String getAutobotName() 
  36.    {
  37.       return autobotName;
  38.    }
  39.  
  40.    public void setAutobotName( String autobotName ) 
  41.    {
  42.       this.autobotName = autobotName;
  43.    }
  44.  
  45.    public int getProductNumber() 
  46.    {
  47.       return productNumber;
  48.    }
  49.  
  50.    public void setProductNumber( int productNumber ) 
  51.    {
  52.       this.productNumber = productNumber;
  53.    }
  54.  
  55.    public int getUnit() 
  56.    {
  57.       return unit;
  58.    }
  59.  
  60.    public void setUnit( int unit ) 
  61.    {
  62.       this.unit = unit;
  63.    }
  64.  
  65.    public double getPrice() 
  66.    {
  67.       return price;
  68.    }
  69.  
  70.    public void setPrice( double price ) 
  71.    {
  72.       this.price = price;
  73.    }
  74.  
  75.    public double getRestock() 
  76.    {
  77.       return restock;
  78.    }
  79.  
  80.    public Double restock()
  81.    {
  82.       return 0.05 * this.getPrice() + this.getPrice();
  83.    }
  84.  
  85.    public double getStock() 
  86.    {
  87.       return stock;
  88.    }
  89.  
  90.    public Double stock()
  91.    {
  92.       return this.getPrice() * this.getUnit();
  93.    } 
  94.  
  95.    public double getTotalRestock() 
  96.    {
  97.       return totalRestock;
  98.    }
  99.  
  100.    public Double totalRestock()
  101.    {
  102.       return this.getPrice() + this.getUnit() * this.getPrice() * 0.05;
  103.    }
  104.  
  105.    public String toString()
  106.    {
  107.       return "\n"+this.productNumber+"\t"+this.autobotName+"\t"+this.unit +"\t"+this.price+ "\t"; 
  108.    }
  109. }
Expand|Select|Wrap|Line Numbers
  1. import java.io.Serializable;
  2.  
  3. public class TransformersSubProduct extends TransformersProduct implements Serializable
  4. {
  5.    public TransformersSubProduct( String autobotName, int productNumber, int unit,
  6.                            double price ) 
  7.    {
  8.       super( autobotName, productNumber, unit, price );
  9.  
  10.       this.restock = this.restock();
  11.  
  12.       this.stock = this.stock();
  13.  
  14.       this.totalRestock = this.totalRestock();
  15.       // TODO Auto-generated constructor stub
  16.    }
  17.  
  18.    public Double restock()
  19.    {
  20.       return this.getPrice() + this.getPrice() * 0.05;
  21.    }                         
  22.  
  23.    public Double stock()
  24.    {
  25.       return this.getUnit() * this.getPrice();
  26.    }                            
  27.  
  28.    public Double totalRestock()
  29.    {
  30.       return this.getUnit() * this.getPrice() + this.getUnit() * this.getPrice() * 0.05;
  31.    }
  32.  
  33.    public String toString()
  34.    {
  35.       return "\n\n" + this.productNumber + "\t" + this.autobotName 
  36.                     + "\t\t" + this.unit   + "\t$ " + this.price 
  37.                     + "\t$ " + this.getRestock() 
  38.                     + "\t$ " + this.getStock() 
  39.                     + "\t$ " + this.getTotalRestock()
  40.                     + "\n"; 
  41.    }
  42. }
  43.  
Nov 19 '07 #1
3 1845
ITAutobot25
7 New Member
Here's my previous assignment, with the sorter working.

Expand|Select|Wrap|Line Numbers
  1. import java.awt.BorderLayout;
  2. import java.awt.Dimension;
  3. import java.awt.FlowLayout;
  4. import java.awt.TextArea;
  5. import java.awt.Container;
  6.  
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9.  
  10. import java.text.Collator;
  11.  
  12. import java.util.Locale;
  13.  
  14. import javax.swing.JButton;
  15. import javax.swing.JFrame;
  16. import javax.swing.JPanel;
  17. import javax.swing.JScrollPane;
  18. import javax.swing.JTextArea;
  19. import javax.swing.ImageIcon;
  20. import javax.swing.JLabel;
  21.  
  22.  
  23. import javax.swing.border.Border;
  24.  
  25. // class declaration for TransformersInventory5
  26. public class TransformersInventory5 extends JFrame implements ActionListener
  27. {
  28.    private static TransformersProductSubClass myTransformers;
  29.    public static int currentRecordShown = 0;
  30.    private JTextArea textArea;
  31.    private JButton first,next,previous,last;
  32.  
  33.    // declare array name autobotNameArray
  34.    static String autobotNameArray[] = { "No Sale bot", "Optimus Prime", "BumbleBee", 
  35.                                         "Ironhide", "Ratchet", "Jazz" };
  36.  
  37.    static int autobotProductArray[] = { 0, 7, 16, 25, 34, 43 }; // product # array
  38.    static int autobotUnitArray[] = { 1, 52, 61, 106, 115, 124 }; // array of autobot toy units
  39.  
  40.    static double autobotPriceArray[] = { 0.00, 160.00, 97.00, 88.00, 79.00,70.00 }; // array of autobot toy prices
  41.  
  42.    static double autobotRestockArray[] = { 0.05 * autobotPriceArray[ 0 ] + autobotPriceArray[ 0 ], 
  43.                                            0.05 * autobotPriceArray[ 1 ] + autobotPriceArray[ 1 ], 
  44.                                            0.05 * autobotPriceArray[ 2 ] + autobotPriceArray[ 2 ], 
  45.                                            0.05 * autobotPriceArray[ 3 ] + autobotPriceArray[ 3 ], 
  46.                                            0.05 * autobotPriceArray[ 4 ] + autobotPriceArray[ 4 ], 
  47.                                            0.05 * autobotPriceArray[ 5 ] + autobotPriceArray[ 5 ] }; // array of autobot stock values
  48.  
  49.    static double autobotStockArray[] = { autobotUnitArray[ 0 ] * autobotPriceArray[ 0 ], 
  50.                                          autobotUnitArray[ 1 ] * autobotPriceArray[ 1 ], 
  51.                                          autobotUnitArray[ 2 ] * autobotPriceArray[ 2 ], 
  52.                                          autobotUnitArray[ 3 ] * autobotPriceArray[ 3 ], 
  53.                                          autobotUnitArray[ 4 ] * autobotPriceArray[ 4 ], 
  54.                                          autobotUnitArray[ 5 ] * autobotPriceArray[ 5 ] }; // array of autobot stock values
  55.  
  56.    static double autobotTotalRestockArray[] = { 0.05 * autobotStockArray[ 0 ] + autobotStockArray[ 0 ], 
  57.                                                 0.05 * autobotStockArray[ 1 ] + autobotStockArray[ 1 ], 
  58.                                                 0.05 * autobotStockArray[ 2 ] + autobotStockArray[ 2 ], 
  59.                                                 0.05 * autobotStockArray[ 3 ] + autobotStockArray[ 3 ], 
  60.                                                 0.05 * autobotStockArray[ 4 ] + autobotStockArray[ 4 ], 
  61.                                                 0.05 * autobotStockArray[ 5 ] + autobotStockArray[ 5 ] }; // array of autobot stock values
  62.  
  63.    public TransformersInventory5()
  64.    {
  65.       textArea = new JTextArea( 250,30 );
  66.  
  67.       JScrollPane scrollPane = new JScrollPane( textArea ); 
  68.  
  69.       textArea.setEditable( false );
  70.  
  71.       scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
  72.  
  73.       scrollPane.setPreferredSize( new Dimension( 250, 250 ) );
  74.  
  75.       JPanel cp = new JPanel();
  76.  
  77.       cp.setSize( 250, 40 );
  78.  
  79.       cp.setLayout( new BorderLayout() );
  80.  
  81.       cp.add( scrollPane,BorderLayout.CENTER );
  82.  
  83.       JPanel buttonPaenl = new JPanel();
  84.  
  85.       first = new JButton( "First" );
  86.       first.addActionListener(this);
  87.  
  88.       next = new JButton( "Next" );
  89.       next.addActionListener( this );
  90.  
  91.       previous = new JButton( "Previous" );
  92.       previous.addActionListener( this );
  93.  
  94.       last = new JButton( "Last" );
  95.       last.addActionListener( this );
  96.  
  97.       buttonPaenl.setLayout( new FlowLayout() );
  98.       buttonPaenl.add( first );
  99.       buttonPaenl.add( previous );
  100.       buttonPaenl.add( next );
  101.       buttonPaenl.add( last );
  102.       cp.add( buttonPaenl, 
  103.               BorderLayout.SOUTH );      
  104.  
  105.       this.setContentPane( cp );
  106.  
  107.       this.setTitle( "Week Eight CheckPoint: Inventory Program Part 5 ( Oooey GUI Phooey -- o_0?! )" );
  108.  
  109.       this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  110.  
  111.       this.pack();
  112.  
  113.       inventorySorter();
  114.  
  115.       myTransformers = new TransformersProductSubClass( "Transformers Autobot Toy Inventory", 
  116.                                                         "5%",  
  117.                                                         autobotNameArray, 
  118.                                                         autobotProductArray, 
  119.                                                         autobotUnitArray, 
  120.                                                         autobotPriceArray,
  121.                                                         autobotRestockArray, 
  122.                                                         autobotStockArray,
  123.                                                         autobotTotalRestockArray );
  124.       textArea.setText( myTransformers.outputInventory() );
  125.  
  126.       this.setVisible( true );
  127.    } // end
  128.  
  129.    // main method begins program execution
  130.    public static void main( String args[] ) 
  131.    {                                         
  132.  
  133.       JFrame frame = new JFrame();
  134.       ImageIcon icon = new ImageIcon("AutobotCompanyLogo.jpg");
  135.       JLabel label = new JLabel(icon);
  136.       Container contentPane = frame.getContentPane();
  137.  
  138.       contentPane.add(label);
  139.       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  140.       frame.pack();
  141.       frame.setVisible(true);      
  142.  
  143.       TransformersInventory5 tfI2 = new TransformersInventory5();        
  144.    } // end main
  145.  
  146.    // inventorySorter method
  147.    public static void inventorySorter()
  148.    {
  149.       String sorter;
  150.  
  151.       int sorterAutobotProductArray,
  152.           sorterAutobotUnitArray;
  153.  
  154.       double sorterAutobotPriceArray,
  155.              sorterAutobotRestockArray,
  156.              sorterAutobotStockArray,
  157.              sorterAutobotTotalRestockArray;
  158.  
  159.       Locale loc = Locale.ENGLISH;
  160.  
  161.       Collator col = Collator.getInstance( loc );
  162.  
  163.       for ( int i = 0; i < autobotNameArray.length; i++ ) 
  164.       {
  165.          for ( int j = i + 1; j < autobotNameArray.length; j++ ) 
  166.          {
  167.             if( col.compare(autobotNameArray[i], autobotNameArray[j] ) > 0 ) 
  168.             {
  169.                sorter = autobotNameArray[ i ];
  170.                sorterAutobotProductArray = autobotProductArray[ i ];
  171.                sorterAutobotUnitArray = autobotUnitArray[ i ];
  172.                sorterAutobotPriceArray = autobotPriceArray[ i ];
  173.                sorterAutobotRestockArray = autobotRestockArray[  i ];
  174.                sorterAutobotStockArray = autobotStockArray[ i ];
  175.                sorterAutobotTotalRestockArray = autobotTotalRestockArray[ i ];
  176.  
  177.                autobotNameArray[ i ] = autobotNameArray[ j ];
  178.                autobotProductArray[ i ] = autobotProductArray[ j ];
  179.                autobotUnitArray[ i ] = autobotUnitArray[ j ];
  180.                autobotPriceArray[ i ] = autobotPriceArray[ j ];
  181.                autobotRestockArray[ i ] = autobotRestockArray[ j ];
  182.                autobotStockArray[ i ] = autobotStockArray[ j ];
  183.                autobotTotalRestockArray[ i ] = autobotTotalRestockArray[ j ];
  184.  
  185.                autobotNameArray[ j ] = sorter;
  186.                autobotProductArray[ j ] = sorterAutobotProductArray;
  187.                autobotUnitArray[ j ] = sorterAutobotUnitArray;
  188.                autobotPriceArray[ j ] = sorterAutobotPriceArray;
  189.                autobotRestockArray[ j ] = sorterAutobotRestockArray;
  190.                autobotStockArray[ j ] = sorterAutobotStockArray;
  191.                 autobotTotalRestockArray[ j ]  = sorterAutobotTotalRestockArray;                
  192.             } // end 2nd inner if
  193.          } // end 1st inner if
  194.       } // end for
  195.    } // end inventorySorter
  196.  
  197.    public void actionPerformed( ActionEvent e ) 
  198.    {
  199.       if( e.getActionCommand().equals( "First" ) )
  200.       {
  201.          textArea.setText( getFirst() );
  202.       }
  203.  
  204.       if( e.getActionCommand().equals( "Next" ) )
  205.       {
  206.          textArea.setText( getNext() );
  207.       }
  208.  
  209.       if( e.getActionCommand().equals( "Previous" ) )
  210.       {
  211.          textArea.setText( getPrevious() );
  212.       }
  213.  
  214.       if( e.getActionCommand().equals( "Last" ) )
  215.       {
  216.          textArea.setText( getLast() );
  217.       }
  218.  
  219.    }
  220.    public String getFirst()
  221.    {
  222.       String firstRecord = getTitleForPrinting();
  223.  
  224.       firstRecord = firstRecord + "\n" + 1 + "\t" + myTransformers.product[ 1 ] + "\t\t\t" 
  225.                     + myTransformers.autobotName[ 1 ] + "\t\t" + myTransformers.unit[ 1 ] 
  226.                     + "\t\t$ " + myTransformers.price[ 1 ] + "\t\t$ " + myTransformers.restock[ 1 ] 
  227.                     + "\t\t$ " + myTransformers.stock[ 1 ] + "\t\t$ " + myTransformers.totalRestock[ 1 ] 
  228.                     + "\n";
  229.  
  230.       currentRecordShown=1;
  231.  
  232.       return firstRecord;
  233.    }
  234.  
  235.    public String getLast()
  236.    {
  237.       int lastindex;
  238.  
  239.       lastindex = myTransformers.product.length-1;
  240.  
  241.       String lastRecord = getTitleForPrinting();
  242.  
  243.       lastRecord = lastRecord + "\n" + lastindex + "\t" + myTransformers.product[ lastindex ] + "\t\t\t" 
  244.       + myTransformers.autobotName[ lastindex ] + "\t\t" + myTransformers.unit[ lastindex ] + "\t\t$ " 
  245.       + myTransformers.price[ lastindex ] + "\t\t$ " + myTransformers.restock[ lastindex ] + "\t\t$ " 
  246.       + myTransformers.stock[ lastindex] + "\t\t$ "+ myTransformers.totalRestock[ lastindex ] + "\n";
  247.  
  248.       currentRecordShown = lastindex + 1;
  249.  
  250.       return lastRecord;
  251.    }
  252.  
  253.    public String getNext()
  254.    {
  255.       if( currentRecordShown == myTransformers.product.length )
  256.          return getFirst();
  257.  
  258.       else
  259.       {
  260.          currentRecordShown++;
  261.  
  262.          String nextRecord = getTitleForPrinting();
  263.  
  264.          int index = currentRecordShown - 1;
  265.  
  266.          nextRecord = nextRecord + "\n" + index + "\t" + myTransformers.product[ index ] + "\t\t\t" 
  267.          + myTransformers.autobotName[ index ] + "\t\t" + myTransformers.unit[ index ] + "\t\t$ " 
  268.          + myTransformers.price[ index ] + "\t\t$ " + myTransformers.restock[ index ] + "\t\t$ " 
  269.          + myTransformers.stock[ index ] + "\t\t$ " + myTransformers.totalRestock[ index ] + "\n";
  270.  
  271.          return nextRecord;
  272.       }
  273.    }
  274.    public String getPrevious()
  275.    {
  276.       if( currentRecordShown == 1 )
  277.          return getLast();
  278.  
  279.       else
  280.       {
  281.          currentRecordShown--;
  282.  
  283.          String previousRecord=getTitleForPrinting();
  284.  
  285.          int index = currentRecordShown - 1;
  286.  
  287.          previousRecord = previousRecord + "\n" + index + "\t" + myTransformers.product[ index ] + "\t\t\t" 
  288.          + myTransformers.autobotName[ index ] + "\t\t" + myTransformers.unit[ index ] + "\t\t$ "
  289.          + myTransformers.price[ index ] + "\t\t$ " + myTransformers.restock[ index ] + "\t\t$ " 
  290.          + myTransformers.stock[ index ] + "\t\t$ " + myTransformers.totalRestock[ index ] 
  291.          + "\n";
  292.  
  293.          return previousRecord;
  294.       }
  295.    }
  296.  
  297.    public String getTitleForPrinting()
  298.    {
  299.       String transformersSub = new String(" ");
  300.  
  301.       transformersSub = "Welcome to the\n" + myTransformers.getInventoryName() + "!\n\n";
  302.  
  303.       transformersSub = transformersSub + "Below is the available inventory:\n\n";
  304.  
  305.       transformersSub = transformersSub + "The restock interest rate is at " + myTransformers.getRestockRate() 
  306.       + ".\n\n";
  307.  
  308.       transformersSub = transformersSub + "Index\tProduct #\t\t\tName\t\tUnits\t\tPrice\t\t";
  309.  
  310.       transformersSub = transformersSub + "Unit Restock Value\t";    
  311.  
  312.       transformersSub = transformersSub + "Stock Value\t\t";
  313.  
  314.       transformersSub = transformersSub + "Total Product Restock\n";
  315.  
  316.       return transformersSub;
  317.    }      
  318. }
Expand|Select|Wrap|Line Numbers
  1. import static java.lang.System.out;
  2.  
  3.  
  4. // class declaration for TransformersProduct
  5. public class TransformersProduct
  6. {
  7.    private String inventoryName; // name of inventory
  8.  
  9.    public String restockRate; // restock rate percentage
  10.  
  11.    public String autobotName[]; // array of autobot toy names
  12.  
  13.    public int product[]; // product # array
  14.    public int unit[]; // array of autobot toy units
  15.  
  16.    public double price[]; // array of autobot prices
  17.    public double restock[];
  18.    public double stock[]; // array of autobot stock values
  19.    public double totalRestock[];
  20.  
  21.    /* nine-argument constructor initializes inventoryName, restockRate, 
  22.     *autobotName, product, unit, price, restock, stock, and totalRestock arrays. */
  23.    public TransformersProduct( String name, String rate, String autobotNameArray[],
  24.                                int autobotProductArray[], int autobotUnitArray[], 
  25.                                double autobotPriceArray[], double autobotRestockArray[],
  26.                                double autobotStockArray[], double autobotTotalRestockArray[] )   
  27.    {
  28.        inventoryName = name; // initialize inventoryName
  29.        restockRate = rate; // initialize restock rate
  30.        autobotName = autobotNameArray; // initialize autobotName
  31.        product = autobotProductArray; // initialize product
  32.        unit = autobotUnitArray; // initialize unit
  33.        price = autobotPriceArray; // initialize price
  34.        restock = autobotRestockArray;
  35.        stock = autobotStockArray;
  36.        totalRestock = autobotTotalRestockArray; // initialize stock
  37.    } // end eight-argument TransformersProduct constructor
  38.  
  39.    // method to set the inventory name
  40.    public void setInventoryName ( String name ) 
  41.    {
  42.       inventoryName = name; // store inventory name
  43.    } // end method setInventoryName
  44.  
  45.    // method to retrieve the inventory name
  46.    public String getInventoryName()
  47.    {
  48.           return inventoryName; // 
  49.    } // end method getInventoryName
  50.  
  51.    // method to set the inventory name
  52.    public void setRestockRate ( String rate ) 
  53.    {
  54.       restockRate = rate; // store restock rate
  55.    } // end method setInventoryName
  56.  
  57.    // method to retrieve the restock rate
  58.    public String getRestockRate()
  59.    {
  60.           return restockRate; //
  61.    } // end method getInventoryName
  62.  
  63.    // display a welcome message to the TransformersInventory5 user
  64.    public void displayMessage()
  65.    {
  66.       // getInventoryName gets the name of the inventory
  67.       out.printf( "Welcome to the\n%s!\n\n", 
  68.                   getInventoryName() );
  69.    } // end method displayMessage
  70.  
  71.    // display a welcome message to the TransformersInventory5 user
  72.    public void displayMessage2()
  73.    {
  74.       // getInventoryName gets the name of the inventory
  75.       out.printf( "The restock interest rate is at %s.\n\n",
  76.                   getRestockRate() );
  77.    } // end method displayMessage2    
  78.  
  79.    //method to display the invertory arrays output
  80.    public void processInventory()
  81.    {
  82.       // output inventory arrays
  83.       outputInventory();
  84.    } // end method processInventory
  85.  
  86.    // output inventory arrays
  87.    public String outputInventory()
  88.    {
  89.       // displays available inventory message
  90.       out.println( "Below is the available inventory:\n" ); 
  91.  
  92.       // create column headings
  93.       out.print( "Index\tProduct #\t\tName\t\tUnits\t\t\tPrice\t\t" );
  94.  
  95.       out.print( " Unit Restock Value\t" ); // create Stock Value column
  96.  
  97.       out.print( "Stock Value\t" ); // create Stock Value column
  98.  
  99.       out.print( "Total Product Restock\n" ); // create Stock Value column
  100.  
  101.       // output each arrays' elements' value
  102.       for ( int toyCounter = 0; toyCounter < autobotName.length; toyCounter++)
  103.             out.printf( "\n%5d%12d%19s%17d             $%10.2f                   $%10.2f     $%10.2f               $%10.2f\n", 
  104.                         toyCounter, product[ toyCounter ], autobotName[ toyCounter ], 
  105.                         unit[ toyCounter ], price[ toyCounter ], restock[ toyCounter ],
  106.                         stock[ toyCounter ], totalRestock[ toyCounter ] );
  107.  
  108.       // calculate entire inventory value 
  109.       double totalStockValue = stock[ 0 ] + stock[ 1 ] + stock[ 2 ] + stock[ 3 ] + stock[ 4 ] + stock[ 5 ];
  110.  
  111.       // calculate the restocking cose
  112.       double totalRestockValue = 0.05 * totalStockValue + totalStockValue;
  113.  
  114.       out.printf( "\nThe value of the entire inventory is $ %.2f\n", totalStockValue );
  115.       out.printf( "\nThe restocking cost for the entire inventory is $ %.2f\n", totalRestockValue );
  116.  
  117.       return "Please Call the subClass function";
  118.  
  119.    }  // end outputInventory
  120. }
Expand|Select|Wrap|Line Numbers
  1. import static java.lang.System.out;
  2.  
  3. public class TransformersProductSubClass extends TransformersProduct
  4. {
  5.    public TransformersProductSubClass( String name, String rate, String autobotNameArray[],
  6.                                        int autobotProductArray[], int autobotUnitArray[], 
  7.                                        double autobotPriceArray[], double autobotRestockArray[],
  8.                                        double autobotStockArray[], double autobotTotalRestockArray[] ) 
  9.    {
  10.       super( name, rate, autobotNameArray, autobotProductArray, autobotUnitArray,
  11.              autobotPriceArray, autobotRestockArray, autobotStockArray, autobotTotalRestockArray );
  12.    }
  13.  
  14.    public String outputInventory()
  15.    {
  16.       String transformersSub = new String(" ");
  17.  
  18.       transformersSub = "Welcome to the\n" + getInventoryName() + "!\n\n";
  19.  
  20.       transformersSub = transformersSub + "Below is the available inventory:\n\n";
  21.  
  22.       transformersSub = transformersSub + "The restock interest rate is at " + getRestockRate() + ".\n\n";
  23.  
  24.       transformersSub = transformersSub + "Index\tProduct #\t\t\tName\t\tUnits\t\tPrice\t\t";
  25.  
  26.       transformersSub = transformersSub + "Unit Restock Value\t";    
  27.  
  28.       transformersSub = transformersSub + "Stock Value\t\t";
  29.  
  30.       transformersSub = transformersSub + "Total Product Restock\n";
  31.  
  32.       for ( int toyCounter = 0; toyCounter < autobotName.length; toyCounter++)
  33.       {
  34.          transformersSub = transformersSub + "\n" +    toyCounter + "\t" + product[ toyCounter ] 
  35.          + "\t\t\t" + autobotName[ toyCounter ] + "\t\t" + unit[ toyCounter ] + "\t\t$ "+ price[ toyCounter ] 
  36.          + "\t\t$ "+ restock[ toyCounter ] + "\t\t$ "+ stock[ toyCounter ] + "\t\t$ "+ totalRestock[ toyCounter ] 
  37.          + "\n";
  38.       }
  39.  
  40.       double totalStockValue = stock[ 0 ] + stock[ 1 ] + stock[ 2 ] + stock[ 3 ] + stock[ 4 ] + stock[ 5 ];
  41.       double totalRestockValue = 0.05 * totalStockValue + totalStockValue;
  42.  
  43.       transformersSub = transformersSub + "\nThe value of the entire inventory with additional 5% is $ " 
  44.       + totalStockValue + "\n";
  45.  
  46.       transformersSub = transformersSub + "\nThe restocking cost for the entire inventory is $ " 
  47.       + totalRestockValue;
  48.  
  49.       return transformersSub;
  50.  
  51.    }
  52. }
Nov 19 '07 #2
r035198x
13,262 MVP
Have a look at this article.
Nov 19 '07 #3
JosAH
11,448 Recognized Expert MVP
Now this is really the last problem (for real now) with this assignment. My sorter is not working. I managed to sort by product name in my previous assignment; however, I can't get it to work on this one. I changed things around so much in the program that I'm lost on how to get it going again. I also blocked that part of the code off with delimiters; I didn't want it to interfere with program
This is an excellent example why people use version control systems. In the worst
case when they goof (like you did) they can revert to a previous (working) version
of the program.

I'm afraid you have to ask a more specific question because dumping wallpaper
full of code and asking us to clean it up for you is not a very appropriate question.

kind regards,

Jos
Nov 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
1661
by: Yang Lee | last post by:
Hi, Could you please try to run the following program it doesnt work for operator overloading function. It doesn't print peoper empName for emp2 object. It prints junk. Just what could be the...
9
1639
by: pmatos | last post by:
Hi all, I have a few question regarding standard C++ and the use of vectors. Imagine: void foo(vector<int> x); vector<int> c; vector<int> x; ----------
24
4004
by: Salad | last post by:
Every now and then I see ads that state something like "Experience with Large Databases ...multi-gig...blah-de-blah" And I have to laugh. What's the difference between a large or small database? ...
5
1292
by: Rog | last post by:
Hello, I went to http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnaspp/html/aspnet- usingtreeviewiewebcontrol.asp and saved down the TreeviewControl.msi file and also...
10
10711
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected =...
5
4180
by: Drew | last post by:
I am having an issue with an app that I built, it seems that Request.Form doesn't want to work sometimes, and only sometimes. For instance, I got a call last week about an error, I had the user...
2
5276
by: parez | last post by:
Hi ALl, I had problem with FormsAuthentication.SignOut(). It wasnt working. Looked arround and saw a lot of posts and different solutions to the problem. And some how (i dont nkow what...
2
1456
by: Telvanni | last post by:
Ok I'm having problems just figuring out how to convert this Sorter void BubbleSort (int list, int length) { int temp; int counter; int index; for (counter = 0;...
10
3727
by: AC | last post by:
I had a page that does some event setup on window.onload: function prepEvents() { document.getElementById("menumap_sales").onmouseover = swapMenuSales; // etc } window.onload = prepEvents;
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.