Find the problem!!!

i want to read the objects -employees- which are stored in manual into vector vm.
when i run this code i get only one same object.this is the screendump:
third 12121
third 12121
third 12121
Devam etmek i�in herhangi bir tu�a bas�n . . .
.why??? pls help me...is there
any other solution to this reading to vector process?
package odev;
import odev.*;
import java.util.*;
import java.io.*;
import odev.transport.*;
public class readRAF
public static void main(String [] args) throws Exception
RandomAccessFile file=new RandomAccessFile ("manual","r");
Vector vm=new Vector();
try{
do{
     vm.addElement( new employee(file.readUTF(),file.readUTF(),file.readInt(),
     file.readBoolean(),transport.readDate(file),
     transport.readDate(file),file.readUTF(),
     file.readUTF()
file.seek(file.getFilePointer() );}
while(file.getFilePointer()<file.length() );}
catch(IOException io){System.out.println(io.getMessage());System.exit(-1);}
for(int y=0;y<vm.size();y++){
employee rt=(employee) vm.elementAt(y);
System.out.println(rt.name+" "+rt.empNum);
System.exit(0);
this is the code to write vector to file:
package odev;
import odev.*;
import java.util.*;
import java.io.*;
public class writeRAF
public static void main(String [] args) throws Exception
RandomAccessFile file=new RandomAccessFile ("manual","rw");//dosyay� olu�tur
     odev.Date h=new odev.Date("12","12","2003");
     odev.Date j=new odev.Date("25","03","1998");
odev.Date l=new odev.Date("13","7","1978");
employee em=new employee("tyh","drt",1212,false,h,j,"21","no");
employee yt=new employee("second","sec",12121,false,h,j,"211","no1");
employee ym=new employee("third","third",12121,false,h,j,"212","no1");
Vector v=new Vector();
v.addElement(em);v.addElement(ym);
v.addElement(yt);
try{
               employee e;
               for(int i=0;i<v.size();i++)
                    e=(employee)v.elementAt(i);
               file.writeUTF(e.name);file.writeUTF(e.surname);file.writeInt(e.empNum);file.writeBoolean(e.gender);
               transport.writeDate(e.dob,file);transport.writeDate(e.dofe,file);file.writeUTF(e.dept);file.writeUTF(e.proTeam);}}
          catch(EOFException r){JOptionPane.showMessageDialog(null,"Can not write to file","ERROR",JOptionPane.ERROR_MESSAGE);}
System.exit(0);

Provide a toString method in your employee class. Then, every time you read in a new employee, before adding it to the vector vm, do a System.out.println on it. That will help you debug what's going on.

Similar Messages

  • How do I find out what program / file is using 100 GB of space on my Hard drive?  Once I find the problem  how do I delete the specific files to increase GB of space?

    How do I find out what program / file is using 100 GB of space on my Hard drive?  Once I find the problem  how do I delete the specific files to increase GB of space?

    Use OmniDiskSweeper
    Once you find file, it can be deleted from within OmniDiskSweeper
    Allan

  • Network slowdowns when migrates to NX1k - TAC aren't finding the problem.

    Hi,
    I have an opened TAC Service Request (Case), and we aren't finding the problem.
    Any help, tip, will be helpfull. Thanks.
    I attached pdf with all information about the topology, tests, environment...
    Problem information
    The network slowdowns starts to happen when more or less the eighth virtual machine is migrated from the DVS VMware to NX1k.
    Ping tests were done from 192.168.39.151 to 192.168.39.9, but the network slowdowns happens from ping of any virtual machine of any hardware to any virtual machine inside the HP hardware DL580 G7, any nic below:
    NetXen HP NV375i Integrated Quad Port Multifunction Gigabit Server Adapter.
    Broadcom Corporation NC382T PCI Express Dual Port Multifunction Gigabit Server Adapter.
    NetXen HP NC522SFP Dual Port 10Gbe Server Adapter.
    Tests were done with a nic at a time, and the network slowdowns happened with all.
    All the hosts and virtual machines are in the same subnet and the same cluster inside the VMWare.
    Best Regards.

    Hi:
    You may also want to post your question in the HP Business Support Forum -- DL Servers section.
    http://h30499.www3.hp.com/t5/ProLiant-Servers-ML-DL-SL/bd-p/itrc-264#.Uf-zltco7Gg

  • I meet a lot of 3G signal when a call signal disappears 3G! I read the manuals and anything I find the problem! I do so with other brands and other cell does not, the same goes when I receive a call!

    I meet a lot of 3G signal when a call signal disappears 3G! I read the manuals and anything I find the problem! I do so with other brands and other cell does not, the same goes when I receive a call!

    Who is your carrier?  Are you actually on 3G?
    Do you have 3G turned on or off?  Settings > General > Network > Enable 3G

  • Receiving this message"Can't create the file "highlighter_welcome_header.jpg." The disk may be damaged or full, or you may not have sufficient access privileges." I have enough storage how do I find the problem?

    Can’t create the file “highlighter_welcome_header.jpg.” The disk may be damaged or full, or you may not have sufficient access privileges.
    How do I find the problem? Disk is not full.

    Try the following:
    delete the iWeb preference files, com.apple.iWeb.plist and com.apple.iWeb.plist.lockfile, that resides in your Home() /Library/Preferences folder.
    go to your Home()/Library/Caches/com.apple.iWeb folder and delete its contents.
    Click to view full size
    launch iWeb and try again.
    If that doesn't help continue with:
    move the domain file from your Home/Library/Application Support/iWeb folder to the Desktop.
    launch iWeb, create a new test site, save the new domain file and close iWeb.
    go to the your Home/Library/Application Support/iWeb folder and delete the new domain file.
    move your original domain file from the Desktop to the iWeb folder.
    launch iWeb and try again.
    OT

  • 27 inch Imac Intel won't boot up. Screen ligthts up, then shows a flashing file folder w question mark. What can I do to find the problem?

    27 inch iMac Intel won't boot up. Screen lights up, then shows a flashing file folder w question mark. What can I do to find the problem?

    Please readd Apple's trouble shooting steps in Flashing question mark appears when you start your Mac

  • Find the problem here?

    It just don't work as it should. The main menu items just
    don't find their correct location in the menu. Anyone find the
    problem? I've commented out the old stuff.

    Slo_Sumo wrote:
    ...Started names of methods with capitals... Fixed them now it works fine.Something that helps identify such problems is using the @Override notation before the method declaration. That would have warned that the method as stated, did not override a method from the parent class.

  • I need a fix for downloads on Mac.  Currently only downloading .part files and can't find the problem.

    I am struggeling to download files in any format (i.e. pdf, dmg etc.).  It deosn't bring up the download list anymore and  in finder under downloads, it has the following suffix eg. xxx.pdf.part.  The file size is usually 0 bites.  Any advice?
    Another comment on this forum back in 2009 suggests donloading applejack.  This did not seem to fix the problem and the latest version only indicates support up to Leopard.  I am currently running Lion... so a little nervous downloading this.
    Any help here would be greatly appreciated, since I am highly dependent on this facility for my studies and other activities!!

    The first step is to disable or remove that download manager entirely. That in itself is a likely cause of your problem.
    The following can be tried in any order:
    — disable all the other extensions in your browsers and try again.
    — are you running any AV software or using Little Snitch? If so, disable those. You'll probably also have to kill those in Activity monitor, as both run background helper processes that run when the main app isn't and can interfere with network connections.
    — look in your Login Items in
     > System Preferences > Users & Groups | Login Items
    and remove any 3rd party apps that are there. Restart the computer and test again.
    If you've tried all those and still have the problem, report back.

  • Aperture 3: After sending my book for printing to Apple the Apple Store told me that my text and the background have the same color and they couldn't print the book. But I couldn't find any problem in the preview. How could I find the problem pages?

    Aperture 3: After sending my book for printing to Apple the Apple Store told me that my text and the background have the same color and they couldn't print the book. But I couldn't find any problem in the preview. How could I find the pages where the problems are? Or otherwise, why doesn't print Apple the book how it is. Idon't need the text which couldn'be seen.

    The forum is for Logic Pro users.. I will ask the moderators to move it to a more appropriate forum for your question/subject
    Cheers..

  • Need help... can't find the problem...

    I'm trying to copmli my program.. but I'm getting
    some errors...
    C:\Umass\CS210\Hw2\SinglyLinkedList.java:301: unreachable statement
              return NOT_FOUND;
    ^
    C:\Umass\CS210\Hw2\SinglyLinkedList.java:316: variable p might not have been initialized
         return p;
    ^
    import java.util.*;
    public class SinglyLinkedList implements List
       * creatino of the SllIterator
      private class SllIterator implements Iterator
           private Node current;
           private Node lastVisited = null;
           private int expectedModCount = modCount;
         public boolean hasNext()
              if(expectedModCount != modCount)
                   throw new ConcurrentModificationException();
              return true;
         public Object next()
              if(!hasNext())
                   throw new NoSuchElementException();
              Object nextItem = current.data;
              lastVisited = current;
              current = current.next;
              return nextItem;
         public void remove()
              if(expectedModCount != modCount)
                   throw new ConcurrentModificationException();
              if(lastVisited == null)
                   throw new IllegalStateException();
              SinglyLinkedList.this.remove(lastVisited);
              lastVisited = null;
              expectedModCount++;     
      // an inner class: This is our node class, a singly linked node!
      private class Node
        Object data;
        Node next;
        Node(Object o, Node n)
          data = o;
          next = n;
        Node(Object o)
          this(o, null);
        Node( )
          this(null,null);
      private Node head; // the "dummy" head reference
      private int size;  // the number of items on the list
      private int modCount = 0;
      public SinglyLinkedList()
        head = new Node(); // dummy header node!
      public void add(int index, Object o)
                Node p = getNode(index);
                Node newNode = new Node(o, p);
                newNode.next = newNode;
                size++;
                modCount++;
      public boolean add(Object element)
           if (element == null) return false;
           // Check for dummy head node
           if (head.data == null)
                head = new Node(element, null);
        else
        // Traverse the list until we find the end
             Node next = head;
             while (next.next != null)
             next = next.next;
        next.next = new Node(element, null);
        size++;     
        return true;
      public boolean addAll(Collection c)
        return true;
      public boolean addAll(int index, Collection c)
        return true;
      public void clear()
           head = new Node("Head", null);
           size = 0;
      // write a recursive implementation here
      public boolean contains(Object o)
        return findPos(o) != NOT_FOUND;
      public boolean containsAll(Collection c)
        return true;
      public boolean equals(Object o)
        return true;
      // write a recursive implementation here
      public Object get(int index)
        return null;
      // NOT implemented: we don't cover hash codes
      // and hashing in this course
      public int hashCode()
        throw new UnsupportedOperationException();
      public int indexOf(Object o)
        return -1;
      public boolean isEmpty()
         return (size() == 0);
      public Iterator iterator()
        return null;
      public int lastIndexOf(Object o)
        return -1;
      // Not implemented: The following two operations are not supported
      // since we are using a singly linked list, which does not allow
      // us to iterate through the elements back and forth easily
      // (going back is the problem)
      public ListIterator listIterator()
        throw new UnsupportedOperationException();
      public ListIterator listIterator(int index)
        throw new UnsupportedOperationException();
      // write a recursive implementation here
      public Object remove(int index)
        return null;
      public boolean remove(Object o)
        return true;
      public boolean removeAll(Collection c)
        return true;
      public boolean retainAll(Collection c)
        return true;
      // write a recursive implementation here
      public Object set(int index, Object element)
        return null;
      public int size()
        return size;
      // NOT implemented: to keep the homework reasonably simple
      public List subList(int fromIndex, int toIndex)
        throw new UnsupportedOperationException();
      public Object[] toArray()
        return null;
      public Object[] toArray(Object[] a)
        // you'll find this piece of code useful
        // it checks the exact type of the array passed as a parameter
        // in order to create a larger array of the same type.
        if (a.length < size)
          a = (Object[])java.lang.reflect.Array.
         newInstance(a.getClass().getComponentType(), size);
        // ... you need to write more code here!
        return a;
      private static final Node NOT_FOUND = null;
      //FindPos
      private Node findPos(Object o)
           for(Node p = head.next; ; p = p.next)
                if(o == null)
                     if(p.data == null)
                     return p;
                else if(o.equals(p.data))
                return p;
                return NOT_FOUND;
      //Get Node
      private Node getNode(int index)
           Node p;
           if(index < 0 || index > size())
                throw new IndexOutOfBoundsException();
           if(index < size() /2)
                p = head.next;
                for(int i = 0; i < index; i++)
                  p = p.next;
           return p;
      //Print The node
      private static void print(Node n)
           Node current = n.next;
           while (current != null){
                System.out.println(current.data);
                current = current.next;
      public static void main (String[] args){
           System.out.println("Singly Linked List");
           System.out.println();
           SinglyLinkedList l = new SinglyLinkedList();
           l.add("F");
           l.add("K");
    }       

    C:\Umass\CS210\Hw2\SinglyLinkedList.java:301: unreachable statement
    return NOT_FOUND;
    ^
    C:\Umass\CS210\Hw2\SinglyLinkedList.java:316: variable p might not have been initialized
    return p;
    ^
    The first problem is because your "for" loop has no "while" condition in it:
    for(Node p = head.next; ; p = p.next)...
    Therefor, the only way out of the loop is via break, return, or exception. In your case, you don't "break" out of the loop, so there's no way it can get to this statement.
    The second problem, you didn't cover all cases to set "p", so it won't let you return an un-initialized value.

  • I Can't Find The Problem!! pls help (ONLY IF U HAVE SOME FREE TIME)

    I'd like to post some code because I cant see the problem, maybe somebody else will see it. Just take a little look if u see some detail let me know pls.
    I have a class word, wich is actualy a representation of a word in some text
    public class Word {
    int timesInText; //how many times this word is in the text
    //A vector with the lines were the word appears
    public Vector<Integer> lines = new Vector<Integer>();
    public String word; //The word we are representing... Very creative Isn't it?
    //The lines were the word appear in a string in this format : , line, line, line...
    StringBuffer Stringlines = new StringBuffer(":");     
    public Palabra(String word) {
    this.word = word;          
    timesInText=1;
    public void wordFinded(int linea) {        
    lines.add(linea);     
    Stringlines.append(", " + linea);     
    timesInText++;     
    public String toString() {        
    String var = word + ": " + Stringlines.toString();
    return var;
    }//End of the word class
    I have a class main, wich is a window with the logic of the program, notice that
    I'll provide only the necesary thing to understand my problem in order to make
    my post shorter. The words I read can't have duplicates but I must say in wich
    lines the duplicates are.
    public class main{
    Vector<Word> words = new Vector<Word>(); //A vector for all the words in text
    JText area = new JTextArea(); //The JTextArea of my window
    public void getWords(){
    JFrame wordsInText = new JFrame("Word Search:");
    JTextArea wordsArea = new JTextArea("\tResult :");
    wordsInText.getContentPane().add(new JScrollPane(wordsArea));
    boolean alreadySeen;
    String text = area.getText();
    String line;
    String word;
    Word wordBeingRead;
    int lines = 0;
    BufferedReader br = new BufferedReader(new StringReader(text)); //To read complete text
    while ((line = br.readLine()) != null)
         lines += 1;
    StringTokenizer st = new StringTokenizer(line, " "); //But line by line
    while (st.hasMoreTokens())
    alreadySeen = false;
    word = st.nextToken();
    wordBeingRead = new Word(word);
    Iterator iter = words.iterator();
    if(!iter.hasNext()) //The first word! save it
    words.add(wordBeingRead);
    else //Yeah... not the first word... Check it...
    Iterator iterAux = palabras.iterator();
    while(iterAux.hasNext()) //Check if it's already defined
    Word p = (Word) iterAux.next();
    if(wordBeingRead.word.equals(p.word)) //It is already defined...
    wordBeingRead.wordFinded(lines); //I got one on line (lines)
    alreadySeen=true; //Yes! It's already seen
    if(alreadySeen==false) //If it's already seen wont get in here
    words.add(wordBeingRead); //A new word! Let's save it
    Iterator iter = palabras.iterator(); //Ok I saved all the words, time to print them
    while(iter.hasNext())
         wordBeingRead = (Word)iter.next();
         wordsArea.append("\n" + WordBeingRead.toString()); //Put them over here
         wordsInText.setSize(400, 400);
    wordsInText.setLocation(100, 75);
    wordsInText.setVisible(true); //Yes! show them
    }catch(Exception e){
    label.setText(e.getMessage()); //If anything goes wrong
    }//End of the class main

    Ok, sorry about that.
    Post your code between code tags (use the code button when you post a reply).I'm new in the forum and the tags doesnt seem to work with netscape, will use IE next time.
    you should not have a main class. You should have a main method inside a class eg:The original name of the class is Ventana, but you can actually name a class main.
    Also, your constructor should have the same name as your class eg:The constructor in the word class it's written like that because I translated the code to english so that it could be more simply to understand.
    4. If you don't get errors tell us what you expect your code to do and what it IS actually doing.Ok I'll give you a sample input and output:
    INPUT:
    "I am sorry for not posting correctly
    I will make sure this wont happen again
    I will be a good user"
    OUTPUT I'm getting:
    I: :
    am: :
    sorry: :
    for: :
    not: :
    posting: :
    correctly: :
    will: :
    make: :
    sure: :
    this: :
    wont: :
    happen: :
    again: :
    be: :
    a: :
    good: :
    user: :
    OUTPUT I would love to have:
    I: 1, 2, 3
    am: 1
    sorry: 1
    for: 1
    not: 1
    posting: 1
    correctly: 1
    will: 2, 3
    make: 2
    sure: 2
    this: 2
    wont: 2
    happen: 2
    again: 2
    be: 3
    a: 3
    good: 3
    user: 3
    I just noticed that I get the double : : Because I do it twice... ^^
    Thanks for the recomendations, and I'm sorry, totally my fault, I mean it.

  • Can you find the problem in this code?

    I've searching some examples of the using of JTable on this forum.
    So I've used a code found here.
    But nothing happens, the JFrame doesn't appear on screen.
    I'm sure my database "CLIENTES" exists inside the db folder. And also there's data inside "CLIENTES" table.
    So, where is the problem then?
    Thanks.
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TelaPrincipal extends JFrame {
       public TelaPrincipal() {
            Vector columnNames = new Vector();
            Vector data = new Vector();
            try {
               //  Connect to the Database
               String driver = "org.hsqldb.jdbcDriver";
               String url = "jdbc:hsqldb:file:./db/CLIENTES";
               String userId = "sa";
               String password = "";
               Class.forName(driver);
               Connection connection = DriverManager.getConnection(url, userId, password);
               //  Read data from a table
               String sql = "SELECT * FROM CLIENTES";
               Statement stmt = connection.createStatement();
               ResultSet rs = stmt.executeQuery(sql);
               ResultSetMetaData md = rs.getMetaData();
               int columns = md.getColumnCount();
               //  Get column names
               for (int i = 1; i <= columns; i++){
                  columnNames.addElement( md.getColumnName(i) );
               //  Get row data
               while (rs.next()) {
                  Vector row = new Vector(columns);
                  for (int i = 1; i <= columns; i++) {
                     row.addElement(rs.getObject(i));
                  data.addElement(row);
               rs.close();
               stmt.close();
            catch(ClassNotFoundException cnfe) {
               cnfe.printStackTrace();
            catch(SQLException sqle) {
              sqle.printStackTrace(); 
            //  Create table with database data
            JTable table = new JTable(data, columnNames);
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add(scrollPane);
        public static void main(String[] args) {
           TelaPrincipal tp = new TelaPrincipal();
           tp.setDefaultCloseOperation(EXIT_ON_CLOSE);
           tp.pack();
           tp.setVisible(true);
    }

    the jdbc driver is not on the classpath?

  • Unable to add a mail account, with Invalid Password error message, yet can log into mail system OK through a browser. Mail technicians can't find the problem.

    When I try to add a newly-created Bigpond account to Thunderbird, I get an error message "User Name or Password Invalid", yet I can log in to this account OK through a browser. When adding the account, Thunderbird says "Configuration found in Mozilla ISP database". I have previously successfully added Bigpond, Yahoo, Outlook and Hotmail accounts to Thunderbird and they are working fine. The Bigpond Technical Support staff have looked into this and cannot see what is wrong but they say they do not support Thunderbird. Any ideas appreciated...

    Thanks. I had tried the auto and manual setups with the same result. IN addition, the Bigpond Support sent me the following which I also tried and got the same result.
    For the settings that needs to be configured for your new mailbox, kindly follow the steps listed below:
    (**Note: Please be advised that BigPond technical support team is only trained for Microsoft mail clients like Outlook Express, windows Live mail and the like. Having said this, we can only provide limited assistance in setting up your email account for your Thunderbird mail client by providing the correct settings that need to be configured.)
    For IMAP server settings:
    Account Type: IMAP
    Incoming IMAP server: imap-mail.outlook.com
    Incoming IMAP mail: port 993
    Outgoing SMTP server: smtp-mail.outlook.com
    Outgoing SMTP port: 587 (with TLS [preferred] or SSL Encryption depending on your e mail app)
    Incoming uses SSL: On (this is required)
    Outgoing uses SSL: On (this is required) (with TLS [preferred] or SSL Encryption depending on your e mail app)
    Authentication Outgoing server (SMTP) authentication: Same as incoming mail server
    For POP server settings:
    Please be advised that before setting up your email account on an email client using a POP mail server, we will need to ensure first that 'Connecting devices and apps with POP' has been enabled through webmail. For instructions on how to do this, kindly follow the steps below:
    - Log In your email account from the BigPond website from the Webmail section located at the top left side of the BigPond home page (http://media.telstra.com.au/home.html).
    - The page then will automatically redirect to an Outlook website in which you will need to click the 'settings icon' (a gear like icon) located at the top left side of the page.
    - From the drop down list, click on 'Options'.
    - It will then direct the page to a new page where you will need to click 'Connect devices and apps with POP' under the Managing your account section.
    - Choose 'Enable' and choose "Do what the device or app says—if it's set to delete messages, delete them." under Deleting downloaded messages.
    - Click on the 'Save' button to save the changes.
    - Log out of from your webmail page and start setting up your email client on your mail client using the following setting below:
    Account Type: POP3
    Incoming POP server: pop-mail.outlook.com
    Incoming POP mail: port 995
    Outgoing SMTP server: smtp-mail.outlook.com
    Outgoing SMTP port: 587 (with TLS [preferred] or SSL Encryption depending on your e mail app)
    Incoming uses SSL: On (this is required)
    Outgoing uses SSL: On (this is required) (with TLS [preferred] or SSL Encryption depending on your e mail app)
    Authentication Outgoing server (SMTP) authentication: Same as incoming mail server
    In looking at the Thunderbird error message, it seems to consistently refer to the User Name and Password. I know they are correct, as I can log in from a browser using them. Is there something in the validation rules that might be the problem? Also, you may be aware that Bigpond is migrating their old Webmail system across to the Outlook platform. Registering new e-mail accounts in Bigpond get created on the Outlook platform, whereas older accounts are still on the Bigpond Webmail system. Is this causing a problem somewhere in validation?

  • Can't find the problem

    I'm just a simple beginner learning java basics, but I'm really trying to do the work on my own. I managed to write a GuessingGame, but it doesn't work and I have no idea why. You don't even have to tell me HOW to solve the problem (although that would be great), I just need to know where it is. So these are my questions:
    1.What is wrong with the following?
    2.Where is the problem?
    3.How can it be solved? (Optional)
    Write and essay between 1-300 words highlighting the key areas covered by these questions and formulate your solutions to the problems encountered.
    import javax.swing.*;
    /** Allows a user to play a number-guessing game.
    The constructor takes the integer to be guessed. */
    public class GuessingGame {
    int theNumber; //The number to be guessed by the user.
    int guessNumber; //The user's guess.
    public void play(int g){
    theNumber=g;
    guessNumber = Integer.parseInt(JOptionPane.showInputDialog("Guess an integer."));
    while(guessNumber!=theNumber){
    if(guessNumber > theNumber){
    JOptionPane.showMessageDialog(null, "Your guess was too high. Guess again.");
    else if(guessNumber < theNumber){
    JOptionPane.showMessageDialog(null, "Your guess was too low. Guess again.");
    JOptionPane.showMessageDialog(null, "You're right!");

    You must add lines to revise your "guessNumber" inside the while block.

  • I'm at my wits end!!! Can't find the problem!!!

    okay, I've got the code written for a vending machine program. i have a text file that loads in field variables to a product class, a money class that handles the basic functions of money handling methods, and a vending machine applet. the files compile fine, but they don't execute. i get an error: nosuchmethod error: main, you know the kind. i don't have a main because i'm trying to run it as an applet, but it won't run when i use appletviewer, it just does't do anything! This is going to be a tough one. But i swear up and down that i will literally find some way to pay the person who can find what the heck is wrong with the code...so, here it is, and i know it's long, but this is the final project in my java class at college, and i can't find where i'm going wrong.
    the vendingmachine:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.text.NumberFormat;
    import java.util.StringTokenizer;
    import utilities.CashIn;
    import utilities.Product;
    public class VendingMachine extends Applet implements ActionListener {
    private Font boldSerif16 = new Font("Serif",Font.BOLD,16);
    private Font boldSerif24 = new Font("Serif",Font.BOLD,24);
    private Font boldItalicSerif24 = new Font("Serif",Font.BOLD+Font.ITALIC,24);
    private Font boldItalicSerif13 = new Font("Serif",Font.BOLD+Font.ITALIC,13);
    private Font boldItalicSerif40 = new Font("Serif",Font.BOLD+Font.ITALIC,40);
    // Mode flag.
    private int mode = 0;
    // Panels for the buttons
    private Panel mainPanel = new Panel();
    private Panel cashPanel = new Panel();
    private Panel selPanel = new Panel();
    private Panel maintPanel = new Panel();
    // Product selection panel buttons
    private Button selBtn[] = new Button[6];
    // Cash customer puts in machine panel buttons
    private Button viewC = new Button("View The Products");
    private Button quit = new Button("Quit");
    private Button bNickle = new Button("Nickel");
    private Button bDime = new Button("Dime");
    private Button bQuarter = new Button("Quarter");
    private Button b$Paper = new Button("$1 Paper");
    private Button b$Coin = new Button("$1 Coin");
    private Label lCredit = new Label(" Credit:");
    private Label lMsg = new Label("");
    private Button bChange = new Button("Change Return");
    private Button purchase = new Button("Purchase");
    private Button maintenance = new Button("Maintenance");
    private Product productForSale [];
    private CashIn changeOH;
    private int $collected = 0;
    private double total$In = 0.00;
    private NumberFormat nf;
    private Image pic;
    private Image picAnim;
    private int prodSel = 999;
    private String line;
    private String f[] = new String[8];
    private int tokenCount;
    private int int3, int4, int5, int6, int7;
    private double dbl4;
    private StringTokenizer strings;
    private int dispense = 99;
    public void init()
    {  setLayout(new BorderLayout());
    productForSale = new Product[6];
    try
    {  BufferedReader inPut = new BufferedReader(new FileReader("Startup.txt"));
    while ((line=inPut.readLine()) != null)
    {  strings = new StringTokenizer(line,",");
    tokenCount = strings.countTokens();
    // Loop thru and retrieve each data element.
    for (int i=0; i<tokenCount; i++)
    f[i] = strings.nextToken();
    // Load the money.
    if (f[0].compareTo("M") == 0)
    {  int3 = Integer.parseInt(f[3]);
    int4 = Integer.parseInt(f[4]);
    int5 = Integer.parseInt(f[5]);
    int6 = Integer.parseInt(f[6]);
    int7 = Integer.parseInt(f[7]);
    changeOH = new CashIn(f[1],f[2],int3,int4,int5,int6,int7);
    // Load the products.
    if (f[0].compareTo("P") == 0)
    {  int3 = Integer.parseInt(f[3]);
    dbl4 = (new Double(f[4])).doubleValue();
    int5 = Integer.parseInt(f[5]);
    int6 = Integer.parseInt(f[6]);
    int7 = Integer.parseInt(f[7]);
    productForSale[int3] = new Product(f[1],f[2],dbl4,int5,int6,int7);
    inPut.close();
    catch(IOException e)
    {  e.printStackTrace();
    setBackground(Color.blue);
    setForeground(new Color(120,0,120));
    setFont(boldSerif16);
    cashPanel.setLayout(new GridLayout(10,1));
    cashPanel.add(viewC);
    cashPanel.add(quit);
    cashPanel.add(bNickle);
    cashPanel.add(bDime);
    cashPanel.add(bQuarter);
    cashPanel.add(b$Paper);
    cashPanel.add(b$Coin);
    cashPanel.add(lCredit);
    cashPanel.add(lMsg);
    cashPanel.add(bChange);
    add(cashPanel,"East");
    selPanel.setLayout(new GridLayout(1,6));
    for (int i=0; i<6; i++)
    {  selBtn[i] = new Button(productForSale.getName());
    selPanel.add(selBtn[i]);
    add(selPanel,"South");
    setBackground(Color.black);
    viewC.addActionListener(this);
    quit.addActionListener(this);
    bNickle.addActionListener(this);
    bDime.addActionListener(this);
    bQuarter.addActionListener(this);
    b$Paper.addActionListener(this);
    b$Coin.addActionListener(this);
    bChange.addActionListener(this);
    nf = NumberFormat.getCurrencyInstance();
    for (int i=0; i<6; i++)
    selBtn[i].addActionListener(this);
    } // =======>> END OF INIT METHOD
    // ** PAINT METHOD **
    public void paint(Graphics g)
    {  int xVal = 35;
    int yVal = 85;
    int xValAnim = 0;
    int yValAnim = 0;
    int c = 0;
    // Paint the product pictures on the vending machine.
    g.setColor(Color.cyan);
    g.setFont(boldItalicSerif24);
    g.drawString(changeOH.getLogo1(),115,40);
    g.setFont(boldItalicSerif13);
    g.drawString(changeOH.getLogo2(),200,60);
    for (int z=0; z<2; z++)
    {  xVal = 35;
    yVal = 85;
    c = 0;
    g.setColor(Color.black);
    g.fillRect(xVal,yVal,500,350);
    g.setColor(Color.yellow);
    for (int i=0; i<2; i++)
    {  for (int j=0; j<3; j++)
    {  g.setFont(boldSerif16);
    g.drawString(nf.format(productForSale[c].getPrice()),xVal+45,yVal-5);
    pic = getImage(getCodeBase(),productForSale[c].getPic());
    g.drawImage(pic,xVal,yVal,null);
    // If product is dispensed get ready to animate.
    if (c == dispense)
    {  xValAnim = xVal;
    yValAnim = yVal;
    picAnim = pic;
    xVal = xVal + 170;
    c++;
    yVal = yVal + 160;
    xVal = 35;
    // If product is dispensed, animate it.
    if (dispense < 99)
    {  for (int y=0; y<40; y++)
    {  g.setColor(Color.black);
    g.fillRect(xValAnim,yValAnim-9,125,125);
    g.setColor(Color.yellow);
    g.drawImage(picAnim,xValAnim,yValAnim,null);
    yValAnim = yValAnim + 10;
    pause(3);
    dispense = 99;
    if (mode == 0)
    {  pic = getImage(getCodeBase(),"OutStock.gif");
    g.drawImage(pic,300,300,null);
    g.setColor(Color.black);
    g.fillRect(1,1,500,300);
    g.setColor(Color.pink);
    g.setFont(boldItalicSerif40);
    g.drawString(changeOH.getLogo1(),10,150);
    g.setFont(boldItalicSerif24);
    g.drawString(changeOH.getLogo2(),160,250);
    mode++;
    } // =======>> END OF PAINT METHOD
    // ** ACTIONPERFORMED METHOD **
    public void actionPerformed(ActionEvent event)
    {  Object source = event.getSource();
    lMsg.setText(" Enter up to $1.00");
    // Customer puts money in the vending machine.
    // Customer paid a nickle
    if (source == bNickle && $collected < 96)
    {  changeOH.nickleIn();
    $collected = $collected + 5;
    // Customer paid a dime
    if (source == bDime && $collected < 91)
    {  changeOH.dimeIn();
    $collected = $collected + 10;
    // Customer paid a quarter
    if (source == bQuarter && $collected < 76)
    {  changeOH.quarterIn();
    $collected = $collected + 25;
    // Customer paid a paper dollar
    if (source == b$Paper && $collected == 0)
    {  changeOH.dollarPaperIn();
    $collected = $collected + 100;
    // Customer paid a coin dollar
    if (source == b$Coin && $collected == 0)
    {  changeOH.dollarCoinIn();
    $collected = $collected + 100;
    // Customer makes their product selection.
    for (int i=0; i<6; i++)
    {  if (source == selBtn[i])
    // Do nothing if customer selects item that isn't on-hand.
    if (productForSale[i].getOnHand() == 0)
    repaint();
    // We have product on-hand.
    else
    {  prodSel = i;
    // Tell customer to add more money if they don't have
    // enough in the machine to handle the purchase.
    if ($collected < (int) (productForSale[i].getPrice() * 100))
    { lMsg.setText("    Insert Money");
    // Customer has enough money in machine to cover purchase.
    else
    {  // Take cost of item from customer's money
    dbl4 = productForSale[i].getPrice() * 100;
    int4 = changeOH.giveChange($collected - (int)dbl4,0);
    // Tell customer to put exact amount in the machine
    // because there isn't enough change to handle purchase.
    if (int4 == 9)
    {  lMsg.setText("Exact Amount Only!");
    // **** Here the purchase was made and committed. ****
    else
    {  total$In = productForSale[i].getPrice() * 100;
    $collected = $collected - (int) total$In;
    productForSale[i].sellProduct();
    dispense = i;
    repaint();
    // If the last product item was sold, set picture to OutStock.gif.
    if (productForSale[i].getOnHand() <= 0)
    productForSale[i].setOutOfStock();
    if ((source == bChange || source == quit) && $collected > 0)
    {  $collected = changeOH.giveChange($collected,1);
    // Here we save the machine info file when customer asks
    // for their change back or quits the machine.
    // Customer has selected to Quit the vending machine program.
    // Quit the program.
    if (source == quit)
    System.exit(0);
    // These commands set up variables to show how much money
    // the customer has in the machine.
    total$In = $collected;
    total$In = total$In / 100;
    lCredit.setText(" Credit: " + nf.format(total$In));
    repaint();
    } // =======>> END OF ACTIONPERFORMED METHOD
    // ** PAUSE METHOD **
    public void pause(int i)
    {  for(long l = System.currentTimeMillis() + (long) i; System.currentTimeMillis() < l;);
    This is the product class:
    package utilities;
    import java.io.*;
    import java.util.StringTokenizer;
    public class Product {
    private String name;
    private String image;
    private String picUsed;
    private double price;
    private int onHand;
    private int sold;
    private int maint;
    public Product(String n, String i, double p, int o, int s, int m)
    {  name    = n;
    image = i;
    picUsed = i;
    price = p;
    onHand = o;
    sold = s;
    maint = m;
    // Reset picture used when product is out of stock.
    public void setOutOfStock()
    {  picUsed  = "OutStock.gif";
    // Get product information
    public String getName()
    {  return name;
    public String getImage()
    {  return image;
    public String getPic()
    {  return picUsed;
    public double getPrice()
    {  return price;
    public int getOnHand()
    {  return onHand;
    public int getQtySold()
    {  return sold;
    public int getMaintDate()
    {  return maint;
    // Sell one of the product.
    public void sellProduct()
    {  onHand--;
    sold++;
    // Set the product values.
    public void setName(String n)
    {  name = n;
    public void setImage(String i)
    {  image   = i;
    picUsed = i;
    public void setPrice(double p)
    {  price = p;
    public void setOnHand(int o)
    {  onHand = o;
    public void setQtySold(int s)
    {  sold = s;
    public void setMaintDate(int m)
    {  maint = m; }
    The money class:
    package utilities;
    import java.math.*;
    public class CashIn {
    private String logo1;
    private String logo2;
    private int numProd;
    private int nickles;
    private int dimes;
    private int quarters;
    private int dollarsP;
    private int dollarsC;
    private int money;
    private double moneyVal;
    private int amtToChange = 0;
    private int hNickle;
    private int hDime;
    private int hQuarter;
    private int hpDollar;
    private int hcDollar;
    public CashIn(String l1, String l2, int p, int q, int d, int n, int dP)
    {  logo1    = l1;
    logo2 = l2;
    numProd = p;
    quarters = q;
    dimes = d;
    nickles = n;
    dollarsP = dP;
    dollarsC = 0;
    money = (n * 5) + (d * 10) + (q * 25) + (dP * 100);
    // Get total of money in machine.
    public double getCashIn()
    {  moneyVal = money;
    moneyVal = moneyVal / 100;
    return moneyVal;
    // Get machine record information.
    public String getLogo1()
    {  return logo1;
    public String getLogo2()
    {  return logo2;
    public int getNumProd()
    {  return numProd;
    public int getNickles()
    {  return nickles;
    public int getDimes()
    {  return dimes;
    public int getQuarters()
    {  return quarters;
    public int getDollarPaper()
    {  return dollarsP;
    public int getDollarCoins()
    {  return dollarsC;
    // Money comes into the machine
    public void nickleIn()
    {  nickles++;
    money = money + 05;
    public void dimeIn()
    {  dimes++;
    money = money + 10;
    public void quarterIn()
    {  quarters++;
    money = money + 25;
    public void dollarPaperIn()
    {  dollarsP++;
    money = money + 100;
    public void dollarCoinIn()
    {  dollarsC++;
    money = money + 100;
    // Give the customer their change.
    public int giveChange(int custMoney, int mode)
    {  hNickle   = nickles;
    hDime = dimes;
    hQuarter = quarters;
    hpDollar = dollarsP;
    hcDollar = dollarsC;
    amtToChange = custMoney / 100;
    for (int i=0; i<amtToChange; i++)
    {  // Give change in dollar coin if possible
    if (hcDollar > 0)
    {  hcDollar--;
    custMoney = custMoney - 100;
    // or else give change in paper dollar
    else
    {  if (hpDollar > 0)
    {  hpDollar--;
    custMoney = custMoney - 100;
    amtToChange = custMoney / 25;
    for (int i=0; i<amtToChange; i++)
    {  if (hQuarter > 0)
    {  hQuarter--;
    custMoney = custMoney - 25;
    amtToChange = custMoney / 10;
    for (int i=0; i<amtToChange; i++)
    {  if (hDime > 0)
    {  hDime--;
    custMoney = custMoney - 10;
    amtToChange = custMoney / 5;
    if (amtToChange > hNickle)
    {  mode = 9;
    for (int i=0; i<amtToChange; i++)
    {  hNickle--;
    custMoney = custMoney - 5;
    if (mode == 1)
    {  nickles   = hNickle;
    dimes = hDime;
    quarters = hQuarter;
    dollarsP = hpDollar;
    dollarsC = hcDollar;
    money = money - custMoney;
    if (mode == 9) custMoney = 9;
    return custMoney;
    the startup text:
    p,Fritos,Images/FritoLay.gif,
    m,$.50,
    p,Dr. Pepper,Images/Dr.Pepper.gif,
    m,$.60,
    p,Pepsi,Images/Pepsi.gif,
    m,$.60,
    p,Coke,Images/CocaCola.gif,
    m,$.60,
    p,Seven-Up,Images/7-Up.gif,
    m,$.60,
    p,Sprite,Images/Sprite.gif,
    m,$.60,
    c,10,20,40,

    S/he's only offering six Dukes here:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=469450&start=0&range=15#2169975
    This problem has been done before. Break this down into something simpler. You don't need an applet. Just do it on the command line. You don't need a database. Just create a flat file if you need some persistent data. Do the simple thing first, then build out from there.
    Click on the special tokens link up above and learn how to use [ code][ code] tags.
    Your code is a big, unreadable mess. You've got pare this down into something sensible. If you can't understand it, it's unreasonable to expect someone on this forum to wade through all of that. - MOD

  • How to find the problem in EP trace file?

    Hi
    Last week all the role assignments to users under LDAP datasource got deleted from the portal. We have reuploaded the role assigmnet. Now got the trace files from the server. How to check what happend on that day ?
    When all roles assignmnets gone?
    Any Keywords to help!
    Thanks!
    Dhiya.J

    Hi both,
    I got the trace file already from J2EE server. Im struggling to find out anything from the trace file ..
    How to check when role assignments got deleted ?
    any LDAP configuration changes ?
    <!LOGHEADER[START]/>
    <!HELP[Manual modification of the header may cause parsing problem!]/>
    <!LOGGINGVERSION[1.5.3.7185 - 630]/>
    <!NAME[./log/defaultTrace.trc]/>
    <!PATTERN[defaultTrace.trc]/>
    <!FORMATTER[com.sap.tc.logging.ListFormatter]/>
    <!ENCODING[UTF8]/>
    <!FILESET[6, 20, 10485760]/>
    <!PREVIOUSFILE[defaultTrace.5.trc]/>
    <!NEXTFILE[defaultTrace.7.trc]/>
    <!LOGHEADER[END]/>
    #1.5 #0018FE349B47007000000C1900001A200004939077FC1A8D#1288148604431#System.err#sap.com/irj#System.err#gmbeqy#17773####c35ae9f0e17611df93420018fe349b47#SAPEngine_Application_Thread[impl:3]_7##0#0#Error##Plain###     at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)#
    #1.5 #0018FE349B47007000000C1A00001A200004939077FC1DC9#1288148604431#System.err#sap.com/irj#System.err#gmbeqy#17773####c35ae9f0e17611df93420018fe349b47#SAPEngine_Application_Thread[impl:3]_7##0#0#Error##Plain###     at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)#
    11d30a40e26211dfaa7e0018fe349b47#SAPEngine_Application_Thread[impl:3]_21##0#0#Error##Plain###Caused by: java.lang.NullPointerException#
    #1.5 #0018FE349B470059000004C300001A20000493A816802148#1288250048138#com.sap.security.core.imp#sap.com/tcwddispwda#com.sap.security.core.imp.[cf=com.sap.security.core.imp.User][md=init][cl=22052]#gmrnis#29282##sghrppr1.sgh.shs_PPH_15804951#gmrnis#e42beac1e26211dfa6230018fe349b47#SAPEngine_Application_Thread[impl:3]_28##0#0#Error##Java###Error while populating "USER.CORP_LDAP.cn=norsheha bte ismail,ou=mro - hims,ou=sgh,dc=sgh,dc=shs,dc=com,dc=sg"
    [EXCEPTION]
    #1#com.sap.security.core.persistence.datasource.PersistenceException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001BD, problem 2001 (NO_OBJECT), data 0, best match of:
         'DC=sgh,DC=shs,DC=com,DC=sg'
         at com.sap.security.core.persistence.datasource.imp.LDAPPersistence.populatePrincipalDatabag(LDAPPersistence.java:1456)
         at com.sap.security.core.persistence.imp.PrincipalDatabagFactoryInstance.getPrincipalDatabag(PrincipalDatabagFactoryInstance.java:2307)
         at com.sap.security.core.imp.User.init(User.java:244)
         at com.sap.security.core.imp.AbstractPrincipal.<init>(AbstractPrincipal.java:186)
         at com.sap.security.core.imp.Principal.<init>(Principal.java:64)
         at com.sap.security.core.imp.User.<init>(User.java:213)
         at com.sap.security.core.imp.User.<init>(User.java:203)
    It keeps on going like this ... any key word to search?
    Thanks!

Maybe you are looking for

  • NTSC to PAL or PAL to NTSC

    I have a client shooting a project in a couple of days and they are wondering what is the best frame rate to shoot at. They will be shooting to HDCAM SR 1920 x 1080 4:2:2 YCbCr 10 bit or to a drive 2880 x 2160 RAW 12 bit Bayer data. If they shoot 2k,

  • How to deploy a VB 6.0 RDC app using CR 9 on Windows Vista

    Post Author: albe CA Forum: Data Connectivity and SQL Hi, I'm trying to deploy a VB 6.0 Report Designer Component (RDC) application using CR 9 on Windows Vista.The installation ends successfully and finally I started my app; all seems to be ok but if

  • For the blue screen at Leopard install, this tech report works for me

    http://docs.info.apple.com/article.html?artnum=306857 I used the second "solution" and my system booted properly after typing in the command lines mentioned in the article. Good luck

  • Living overseas and want to unlock iphone

    I am living overseas for 2 years with the peace corps and I would really love to be able to use my iphone with a carrier here, but it is currently locked. Verizon is frustratingly hard to contact to get anything answered! Is there any way I can get m

  • Renaming Originals

    Hi, Quick Question that i can't seem to get. Is it possible to batch rename original files in Aperture (Master). I am hoping to move to Aperture from ACR and can't seem to see how to batch rename originals. In Bridge I would edit then rename and hope