Solved

Errors now in program need help!

Posted on 2004-04-17
8
268 Views
Last Modified: 2010-03-31
I now get these errors the trying to run the code you hlep with.

JAVA
 SDK...

C:\Documents and Settings\Glyn Jackson\Desktop\Doctors Surgery 2004>set PATH=c:\
j2sdk1.4.1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

C:\Documents and Settings\Glyn Jackson\Desktop\Doctors Surgery 2004>javac AppInt
erface.java
.\assignDoctor.java:4: package net.proteanit.util does not exist
import net.proteanit.util.PersistentStringList;
                          ^
.\assignDoctor.java:5: package net.proteanit.util does not exist
import net.proteanit.util.StringList;
                          ^
.\AppButtonInterface.java:148: main(java.lang.String[]) in assignDoctor cannot b
e applied to ()
   e.main();
    ^
.\assignDoctor.java:28: cannot resolve symbol
symbol  : variable patientFile
location: class assignDoctor
    patientFile = new PersistentStringList(strFile);
    ^
.\assignDoctor.java:28: cannot resolve symbol
symbol  : class PersistentStringList
location: class assignDoctor
    patientFile = new PersistentStringList(strFile);
                      ^
5 errors




//down below is the code for assignDoctor class. -------------------------------------------

import javax.swing.*;
import java.io.*;
import net.proteanit.util.PersistentStringList;
import net.proteanit.util.StringList;


public class assignDoctor {
 // private PersistentStringList patientFile;


  public static void main(String[] args) {
    System.out.println("testtststststts");
    assignDoctor ad = new assignDoctor();
    ad.findPatientRecord();
  }


  public boolean findPatientRecord() {
    String strFile = String.valueOf(JOptionPane.showInputDialog(null,
        "Please Enter ID to Search For?", "System Search Question",
        JOptionPane.ERROR_MESSAGE, null, null, "1"));
    System.out.println(strFile);
    File f = new File(strFile);
    if (f.exists()) {
      JOptionPane.showMessageDialog(null, "File Was Found", "System Message: Record Found!", JOptionPane.INFORMATION_MESSAGE);
      // Open the record
    patientFile = new PersistentStringList(strFile);
      return true;
    }
    else {
      JOptionPane.showMessageDialog(null, "There is no Record with that ID!", "System Message", JOptionPane.ERROR_MESSAGE);
      return false;
    }
  }
}










//here is the code for the other call which is generating 1 of the errors also


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class AppButtonInterface extends JFrame {
   private JButton PatientButton, PrintButton, PrintDoctorButon, AssignDoctor, DoctorButton, ExitButton, RemoveButton, RemoveDoctor;

   // set up GUI
   public AppButtonInterface()
   {
      super( "Welcome to Doctors Surgery 2004 v1" );

      // get content pane and set its layout
      Container container = getContentPane();
      container.setLayout( new FlowLayout() );

      // create buttons------------------------------
      PatientButton = new JButton( "Add Patient" );
      container.add( PatientButton );

      PrintButton = new JButton( "Print Patient File" );
      container.add( PrintButton );

      RemoveButton = new JButton( "Remove Patient File" );
      container.add( RemoveButton );

      DoctorButton = new JButton( "Add Doctor" );
      container.add( DoctorButton );

      PrintDoctorButon = new JButton( "Print Doctor File" );
      container.add( PrintDoctorButon );

      RemoveDoctor = new JButton( "Remove Doctor File" );
      container.add( RemoveDoctor );

      AssignDoctor = new JButton( "Assign Patient With Doctor" );
      container.add( AssignDoctor );

      ExitButton = new JButton( "Exit System" );
      container.add( ExitButton );


      // create buttons------------------------------


      // create an instance of inner class ButtonHandler
      // to use for button event handling
      ButtonHandler handler = new ButtonHandler();
      ExitButton.addActionListener( handler );
      PatientButton.addActionListener( handler );
      PrintButton.addActionListener( handler );
      DoctorButton.addActionListener( handler );
      RemoveButton.addActionListener( handler );
      RemoveDoctor.addActionListener( handler );
      PrintDoctorButon.addActionListener( handler );
      AssignDoctor.addActionListener( handler );

      setSize( 400, 200 );
      setVisible( true );

   } // end ButtonTest constructor

   public static void main( String args[] )
   {
      AppButtonInterface application = new AppButtonInterface();
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

   }

   // inner class for button event handling
   private class ButtonHandler implements ActionListener {

     //HANDLE BUTTON EVENTS
      public void actionPerformed( ActionEvent event )
      {


        // CREATE OBJECT READY TO CALL FROM CLASS
        SystemMessages a = new SystemMessages();
        getPatient b = new getPatient();
        getDoctor c = new getDoctor();



        //EXIT BUTTON EVENT!
        if (event.getActionCommand() == "Exit System")
        {
          //LOAD FROM SYSTEM MESSAGE
          a.exitsystem();
          //EXIT PROGRAM
          System.exit(0);
        }

        else if (event.getActionCommand() == "Add Patient")
        {
            a.loading();
            b.getnewPatient();

        }

        else if (event.getActionCommand() == "Print Patient File")
       {
         a.loading();
         b.PrintPatient();


       }

       else if (event.getActionCommand() == "Remove Patient File")
       {
         a.loading();
         b.RemovePatient();


       }

       else if (event.getActionCommand() == "Add Doctor")
     {
       a.loading();
       c.doctor();


     }

     else if (event.getActionCommand() == "Remove Doctor File")
    {
      a.loading();
      c.RemoveDoctor();


    }

    else if (event.getActionCommand() == "Print Doctor File")
    {
      a.loading();
      c.PrintDoctor();


     }


     else if (event.getActionCommand() == "Assign Patient With Doctor")
     {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.main();

//this is where 1 of the errors is!!!!!!!


     }


      }

   } // end private inner class ButtonHandler

} // end class ButtonTest
0
Comment
Question by:pigmentarts
  • 5
  • 2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10850366
>>import net.proteanit.util.PersistentStringList;

If you look at the code i originally gave you, i said to remove these package declarations
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 10850570
when i did that the line:

 patientFile = new PersistentStringList(strFile);

has an error?
0
 
LVL 92

Expert Comment

by:objects
ID: 10851114
import javax.swing.*;
import java.io.*;

public class assignDoctor {


  public static void main(String[] args) {
    System.out.println("testtststststts");
    assignDoctor ad = new assignDoctor();
    ad.findPatientRecord();
  }


  public boolean findPatientRecord() {
    String strFile = String.valueOf(JOptionPane.showInputDialog(null,
        "Please Enter ID to Search For?", "System Search Question",
        JOptionPane.ERROR_MESSAGE, null, null, "1"));
    System.out.println(strFile);
    File f = new File(strFile);
    if (f.exists()) {
      JOptionPane.showMessageDialog(null, "File Was Found", "System Message: Record Found!", JOptionPane.INFORMATION_MESSAGE);
      return true;
    }
    else {
      JOptionPane.showMessageDialog(null, "There is no Record with that ID!", "System Message", JOptionPane.ERROR_MESSAGE);
      return false;
    }
  }
}
0
 
LVL 92

Expert Comment

by:objects
ID: 10851118
  else if (event.getActionCommand() == "Assign Patient With Doctor")
     {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.main(null);
}

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 92

Expert Comment

by:objects
ID: 10851123
thats last bit would be better written as the foillowing though:

   else if (event.getActionCommand().equals("Assign Patient With Doctor")
   {
   a.loading();
   assignDoctor e = new assignDoctor();
   e.findPatientRecord();
   }
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10851130
> else if (event.getActionCommand() == "Assign Patient With Doctor")

and all those tests should use equals method instead of ==

else if (event.getActionCommand().equals("Assign Patient With Doctor"))
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 10853868
i did not know that why is .equals different then == , and thanks for your help!
0
 
LVL 92

Expert Comment

by:objects
ID: 10855559
== tests for object equality, where the String's equals method tests for string equality.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json example 39 114
@SBGen Method 3 25
Java Filesystem manipulation of Word Docx file (find replace text) 3 40
recursion example 16 69
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now