الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Phone Directory program

بدأه طالبة مجتهدة 2012 في 21 ديسمبر 2012 · 4 رد · 1,371 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي هذا السؤال

518738347.jpg

و هذا الاوت بوت

163771273.jpg

فكرة البرنامج انه الطالب يبحث عن معلومات استاذة ( اسم المس و رقم التلفون و اي دي الاستاذة) البحث عن طريق رقم روم الاستاذة كتبت الكود باستخدام الدبلي لنك لست

لما وريته الاستاذة قالت ضروري انك تضيفي انسيرت مثود ع اساس انه المستخدم يقدر يضيف معلومات استاذات جدد غير الموجودات باللستة اللي بالبرنامج

لو ما اضفته ما راح تقبل مني البرنامج :( التسليم بعد كم يووووم

اضفت انسيرت مثود بس عندي بعض الايرر

و هذي الاربعة كلاسات للبرنامج

main class

 //-------------------------------------------------------------------------------------Backages
import java.util.*;
import java.util.Scanner;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

//--------------------------------------------------------------------------------------Class Main
public class Main extends JFrame 
{
         final Users theUser = new Users();

//------------------------------------------------------------------------------------1--Method main  
public static void main(String[] args)
  { 
        new Main().setVisible(true);//call method Main   
  }//end public static void main

//-----------------------------------------------------------------------------------2--Mathod Main
  public Main() 
  {
         theUser.Users();
         //------------------
         setTitle("Phone Directory");
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//---------------------------------------------------------------------------Date-Photo-size-color
         Date da = new Date();
         Container contentPane = getContentPane();
         contentPane.setLayout(new BorderLayout());
         contentPane.setBackground(Color.green);
         setSize(300,300);
         //-------------------
         JLabel time = new JLabel("          Today is : " +da);
       getContentPane().add(time);
         //----------------
        setResizable(false);		
         setLocationRelativeTo(null); 	
         String imgStr1 = "c://EQLS.png";
         ImageIcon image = new ImageIcon(imgStr1);	 
         JLabel label1 = new JLabel(" ", image, JLabel.CENTER);
         getContentPane().add(label1);
         validate();	
         setVisible(true); 
//-----------------------------------------------------------------------------------------Button1
    JButton button1 = new JButton("*~...~*  Welcome *~...~*");

    button1.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) 
      {
          JOptionPane.showMessageDialog((Component) e.getSource(), "\n\nThe main idea behind my system is\n\n\n to make the search for teacher information easier using a computer system.\n\n");
        }
    });//end button1

//-----------------------------------------------------------------------------------------Button2
    JButton button2 = new JButton("Main User Access: Phone Directory");
    button2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e)
      { 
         String Option1 = JOptionPane.showInputDialog(null,"Please Enter The Number of Choice !? \n1) View list ROOM\n2) SEARCH THE DATA OFTEACHER\n3) Remove DATA OF TEACHER list\n4) Delete\n5) Return\n6) Exit\n", "Phone Directory Options", JOptionPane.INFORMATION_MESSAGE);
         int ConvOption1 = Integer.parseInt(Option1);
         theUser.mainUser(ConvOption1,Option1);//go to main User method
      }//end method public void actionListener       String Option1 = JOptionPane.showInputDialog(
    });//end button2

//-----------------------------------------------------------------------------------------Button3		 
    JButton button3= new JButton("Exit");
    button3.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e)
      {
        int result = JOptionPane.showConfirmDialog((Component) e.getSource(),"Close Phone Directory SYSTEM");
        if (result == JOptionPane.YES_OPTION)
        {System.exit(0);} 
      }
    });//end button3
//------------------------------------------------------------------------------------------
  //  setLayout(new FlowLayout(FlowLayout.CENTER));
    setLayout(new GridLayout(8,4));
    getContentPane().add(button1);

   getContentPane().add(button2);

    getContentPane().add(button3);

  }//end public method Main
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}//end class Main

users class

import javax.swing.JFrame; 
import java.util.Scanner;
import javax.swing.JOptionPane;

class Users
{ 
     linkList theList = new linkList();
     Scanner input = new Scanner(System.in);

       int a = 0; 
       int b = 0;       
       int key,r;
       Link v,d, f;

public void Users()
{    

JOptionPane.showMessageDialog (null, "   *~...~*  WELCOME *~...~*\n\n  PHONE DIRECTORY SYSTEM\n\n    For Login Please Click Ok\n\n", " {ELECTRONIC SYSTEM OF PHONE DIRECTORY]", JOptionPane.INFORMATION_MESSAGE);
 JFrame frame = new JFrame();

        int SENTINEL = 123; //password number
        String str;  //password number which the user will Enter it
        int password = 0;
        int counter = 5;


while (counter != 0 && password != SENTINEL)
       {     
        str = JOptionPane.showInputDialog("Enter Password");

        password = Integer.parseInt(str);

        if(password == SENTINEL)
        {
            JOptionPane.showMessageDialog(null, "CORRECT");
            System.out.println("\n\t*~...~* The Messages of PHONE DIRECTORY SYSTEM *~...~*\n\n-------------------------------------------------------------------------- \n");        
        }
        else if(password!=SENTINEL)
        {
             JOptionPane.showMessageDialog(null, "Wrong try again");
        }
        counter = counter-1;

        if (counter == 0)
        {
            JOptionPane.showMessageDialog(null, "Acces Denied!!! \nPlease contact Helpdesk");      
            System.exit(0);
        }
       }
           String backupDir="" ;

                theList.insertFirst(16, "08120014", "Ms. Fahmeeda Aziz","043258088");
                theList.insertFirst(15, "08120014", "Dr. Farhana Shaheen ","043258088");
                theList.insertFirst(14, "08120014", "Dr. Fatima Al-Zwaihri ", "043258088");
                theList.insertFirst(13, "08120014", "Dr. Tahani Sindi    ", "043258088"); 
                theList.insertFirst(12, "08120014", "Dr. Nagla Osman     ", "043935024"); 
                theList.insertFirst(11, "08120014", "Ms. Atiya Azmi      ", "043258088"); 
                theList.insertFirst(10, "08120014", "Ms. Aisha Al-Johani   ", "043258088");
                theList.insertFirst(9, "08120014", "Ms. Siti Haryani Mohd ", "043935024"); 
                theList.insertFirst(8,"08120014", "Ms.Humera Ghani     ", "043258088");
                theList.insertFirst(7, "08120014", "Ms. Salma Sadiqha    ", "043258088");
                theList.insertFirst(6, "08120014", "Ms. Azra Sultana     ", "043935024"); 
                theList.insertFirst(5, "08120014", "Ms. Ruchi Tuli     ", "043258088");
                theList.insertFirst(4, "08120014", "Ms. Fozia Noor   ", "043258088");
                theList.insertFirst(3, "08120014", "Ms. Kajal nusratullah  ", "043258088");
                theList.insertFirst(2, "08120014", "Ms.Anusuyah Subbarao  ", "043935024");
                theList.insertFirst(1, "08120014", "Ms. Aizal Yusrina ", "043258088");
}

public void mainUser(int ConvOption1,String Option1)
{
while(ConvOption1!=6)
    {
       switch (ConvOption1) // 5 cases
       {
       case 1: {
               theList.displayList();
               System.out.println("---------------------------------------------------------------------------\n");
              }
       break;

       case 2: {

       	//  Option1 = JOptionPane.showInputDialog("Enter how MANY TEACHERS U WANT TO FIND");
      //        a = Integer.parseInt(Option1);

    System.out.println("Enter how MANY TEACHERS U WANT TO FIND");
            a=input.nextInt();

              //theList. display1() ;
               for(int j=1;j<=a;j++)
               {

           //    	Option1 = JOptionPane.showInputDialog("\nEnter Number of Teacher Room   ÏÏ "+j+" ÏÏ ");
           //     b = Integer.parseInt(Option1);

             System.out.println("\nEnter Number of Teacher Room   ÏÏ "+j+" ÏÏ ");
               b=input.nextInt();

               f = theList.find( b); 
                        // find item
               if( f != null)
               {

            System.out.println("\nTEACHER NAME IS: "+f.Teacher_Name+"\nTEACHER ID: "+f.teacher_ID+"\nPHONE NUMBER IS: "+f.Phone_number);

             //  JOptionPane.showMessageDialog(null,"\nTEACHER NAME IS: "+f.Items+"\nTEACHER ID: "+f.qui+"\nPHONE NUMBER IS: "+f.price);

                // System.out.println("\nQuintity of "+f.Items+" Now is "+e);

                 }
               else
               {
               System.out.println("we did FOUND "+f.Teacher_Name);  
                } 
                }

              // System.out.println("\n ÒÒ price ="+t);

              System.out.println("---------------------------------------------------------------------------\n");
            }
      break;

      case 3: {

          System.out.println("Enter THE ROOM NUMBER OF TEACHER  ");
          int key=input.nextInt();
          Link i = theList.delete(key);        // delete item
          if( i != null )
          {

           System.out.println("Deleted NUMBER OF ROOM : "+  i.Room_Number+"\n");
           System.out.println("Delet the ID :  "+i.teacher_ID +"\n");
           System.out.println("Delet the Name Of TEACHER : "+ i.Teacher_Name+"\n" );
           System.out.println("Delet the PHONE NUMBER :  "+i.Phone_number+"\n");


          System.out.println("SUCCESSFUL DELET");
          } 
          else
          {

          System.out.println("Can't delete ");

          System.out.println("the data still in list "+i);
          }
          System.out.print("---------------------------------------------------------------------------\n");
             } 
          break;

       case 4: {
              theList.display2();
              System.out.println("Enter ROOM NUMBER:>");
              key= input.nextInt();
              Link i = theList.delete(key);  
              System.out.print("---------------------------------------------------------------------------");

              System.out.println("\nlist after EDIT:>");
              theList.display2();
              System.out.println("---------------------------------------------------------------------------\n");
             }
        break;

                 case 5: {
              theList.display2();
              System.out.println("Enter New Teacher  Room NUMBER:>");
              key= input.nextInt();
              Link i =  theList.insertLast(key);  
              System.out.print("---------------------------------------------------------------------------");

              System.out.println("\nlist after EDIT:>");
              theList.display2();
              System.out.println("---------------------------------------------------------------------------\n");
             }
        break;
   }//end switch

    if(ConvOption1>6)
    {

     JOptionPane.showMessageDialog(null, "YOUAR INPUT NUMBER NOT IN THE LIST\n              PLEASE, TRY AGAIN");   	
    }
     Option1 = JOptionPane.showInputDialog("\n1-Show List of TEACHERS\n2-SEARCH \n3-Remove \n4-Borrow\n5-Return\n6-Exit");
     ConvOption1 = Integer.parseInt(Option1);
    }//end while
   }
}//end mainUser method

Link class

 class Link 
  { 
    public int Room_Number; 
    public String teacher_ID; 
    public String Teacher_Name; 
    public String Phone_number; // data item 
    public Link next; // next link in list 

    // ------------------------------------------------------------- 

    public Link(int a, String b, String teacher, String Phone) // constructor 
    { 
        Room_Number = a; 
        teacher_ID = b; // constructor 
        Teacher_Name = teacher; 
        Phone_number = Phone; 

    } // set to null) 
        // ------------------------------------------------------------- 

    public void displayLink1() 
    // display ourself 
    { 

        System.out.println("\t" + Teacher_Name + "\t\t{" + Room_Number + "}"); 
        System.out.println(""); 
    } 


    public void displayLink2() 
    // display ourself 
    { 
        System.out.print("\t" + Room_Number); 
        System.out.print("\t" + teacher_ID); 
        System.out.print("\t" + Teacher_Name); 
        System.out.println("\t\t{" + Phone_number + "}"); 
    }
}

linkList class

class linkList
 { 
    private Link first; // ref to first link on list 

    // ------------------------------------------------------------- 
    public linkList() // constructor 
    { 
        first = null; // no links on list yet 
    } 

    // ------------------------------------------------------------- 
    public boolean isEmpty() // true if list is empty 
    { 
        return (first == null); 
    } 
    // ------------------------------------------------------------- 
    // insert at start of list 
        public String insertFirst(int a, String SD, String teacher, String Phone) { // make 
                                                                        // new 
                                                                        // link 
        Link newLink = new Link(a, SD, teacher, Phone); 
        newLink.next = first; // newLink --> old first 
        first = newLink; // first --> newLink 
        return first.Room_Number + "  " + first.teacher_ID + "  " + first.Teacher_Name + "{" + first.Phone_number + "}"; 
    } 

    // ------------------------------------------------------------- 
    public Link find(int key) // find link with given key 
    { // (assumes non-empty list) 
        Link current = first; // start at 'first' 
        while (current.Room_Number != key) // while no match, 
        { 
            if (current.next == null) // if end of list, 
                return null; // didn't find it 
            else 
                // not end of list, 
                current = current.next; // go to next link 
        } 
        return current; // found it 
    } 

    // ///////////////////////////////////// 
    public Link delete(int key) // delete link with given key 
    { // (assumes non-empty list) 
        Link current = first; // search for link 
        Link previous = first; 
        while (current.Room_Number != key) { 
            if (current.next == null) 
                return null; // didn't find it 
            else { 
                previous = current; // go to next link 
                current = current.next; 
            } 
        } // found it 
        if (current == first) // if first link, 
            first = first.next; // change first 
        else 
            // otherwise, 
            previous.next = current.next; // bypass it 
        return current; 
    } 


    // -------------------------------------------------------------

 public void insertLast( int key)    
      {
      Link newLink = new Link(key); // make new link
      if( isEmpty() )                // if empty list,
         first = newLink;            // first --> newLink
      else
         {
         last.next = newLink;        // old last --> newLink
         newLink.previous = last;    // old last <-- newLink
         }
         last = newLink;                // newLink <-- last
      }

    // ------------------------------------------------------------- 

    public void displayList() { 
        System.out.println("\t\t\n\n                        *~...~*  Welcome *~...~*\n\n "); 
        System.out.print("\n\n\t\t               The Menue  \n\n"); 
        System.out.println("\n\t :: NAME OF TEACHERS ::\t\t:: NUMBER OF ROOM ::"); 
        System.out.println(""); 
        Link current = first; // start at beginning of list 
        while (current != null) // until end of list, 
        { 
            current.displayLink1(); // print data 
            current = current.next; 
            // move to next link 
        } 
        System.out.println(""); 
    } 

    public void display2() { 
        System.out.print("\t\t        *~...~*  The Menue *~...~*  \n\n"); 
        System.out.println("\n\tR.N.    ID              TEACHER NAME \t                PHONE NUMBER\n "); 
        Link current = first; // start at beginning of list 
        while (current != null) // until end of list, 
        { 
            current.displayLink2(); // print data 
            current = current.next; 
            // move to next link 
        } 
        System.out.println(""); 
    } 
    // ------------------------------------------------------------- 
} // end class LinkList
#2

الكود به خطأ على ما اعتقد

1

556891961.gif

I am learning from you

it is the programmer eye

#3

.......

تم تعديل هذه المشاركة بواسطة طالبة مجتهدة 2012 في 22 ديسمبر 2012 في 16:50

#4

بكرة ان شاء الله تسليم المشروع

عندي مشكلتين

اول مشكلة انه لما يختار المستخدم رقم 4 لعملية ادخال بيانات جديدة لللستة

200359048.jpg

يروح يساله عن رقم الروم الجديد اللي يبغى يضيفه و اسم الاستاذة و رقم الاي دي و الهاتف

و يطلع له اللستة بعد اضافة المعلومات الجديدة

بس المشكلة بترتيب المسافة مو زابط رايح ع اليسار شوي

حاولت ازبطه ما زبط :(

399367220.jpg

و ثاني مشكلة لما يطلب من المستخدم رقم الروم و بعدها اسم الاستاذة الجديدة اللي يبغى يضيفها للستة لو دخل المستخدم مثلا ( الاء احمد )

ع طول يطلع له القائمة بعد اضافة البيانات و يحسب الااء كاسم الاستاذة و كلمة احمد ع رقم هاتف :( يعني ما ينفع الا ادخل اسم واحد من غير اسم الوالد

115598047.jpg

و هذي الاكواد

Class Link

//===============================================================================================
 public class Link
 {
     public String Teacher_Name;
     public String teacher_ID; 
     public String Phone_number; 
     public int Room_Number; 
     public Link next; // next link in list 
     public Link previous; // previous link in list
 //===============================================================================================
  public Link(int a, String b, String teacher, String Phone) // constructor 
{ 
        Room_Number = a; 
        teacher_ID = b;  
        Teacher_Name = teacher; 
        Phone_number = Phone; 
}
//===============================================================================================

public void displayLink1()        // display this link
 { 
        System.out.println("\t" + Teacher_Name + "\t\t{" + Room_Number + "}"); 
        System.out.println("");  
   }

//===============================================================================================      
   public void displayLink2() 
    { 
        System.out.print("\t" + Room_Number); 
        System.out.print("\t" + teacher_ID); 
        System.out.print("\t"  +Teacher_Name); 
        System.out.println("\t\t{" + Phone_number + "}"); 
    } 
 }
 //===============================================================================================

Class DoublyLinkList

//===============================================================================================
class DoublyLinkList
 { 
    private Link first; // ref to first link on list 
//===============================================================================================
    public DoublyLinkList() // constructor 
    { 
        first = null; // no links on list yet 
    } 
//===============================================================================================
    public boolean isEmpty() // true if list is empty 
    { 
        return (first == null); 
    } 
//===============================================================================================  
      // insert at start of list 
        public String insertFirst(int a, String ID, String teacher, String Phone) 
        { 
        Link newLink = new Link(a, ID, teacher, Phone); 
        newLink.next = first;  
        first = newLink; 
        return first.Room_Number + "  " + first.teacher_ID + "  " + first.Teacher_Name + "{" + first.Phone_number + "}"; 
    }  
//===============================================================================================  
   public void displayList() { 
        System.out.println("\t\t\n\n                        *~...~*  Welcome *~...~*\n\n "); 
        System.out.print("\n\n\t\t               The Menue  \n\n"); 
        System.out.println("\n\t :: NAME OF TEACHERS ::\t\t:: NUMBER OF ROOM ::"); 
        System.out.println(""); 
        Link current = first; // start at beginning of list 
        while (current != null) // until end of list, 
        { 
            current.displayLink1(); // print data 
            current = current.next; 
            // move to next link 
        } 
        System.out.println(""); 
    } 
//===============================================================================================  
        public Link find(int key) // find link with given key 
    { // (assumes non-empty list) 
        Link current = first; // start at 'first' 
        while (current.Room_Number != key) // while no match, 
        { 
            if (current.next == null) // if end of list, 
                return null; // didn't find it 
            else 
                // not end of list, 
                current = current.next; // go to next link 
        }
        return current; // found it 
   }  
//===============================================================================================  
        public Link delete(int key) // delete link with given key 
    { // (assumes non-empty list) 
        Link current = first; // search for link 
        Link previous = first; 
        while (current.Room_Number != key) { 
            if (current.next == null) 
                return null; // didn't find it 
            else { 
                previous = current; // go to next link 
                current = current.next; 
            } 
        } // found it 
        if (current == first) // if first link, 
            first = first.next; // change first 
        else 
            // otherwise, 
        previous.next = current.next; // bypass it 
        return current; 
    } 
//=============================================================================================== 
       public void insertLast(int new1, String new2, String new3, String new4)    
      {
      Link newLink = new Link( new1,  new2,  new3,  new4);   // make new link

      first.previous = newLink;   // newLink <-- old first
      newLink.next = first;          // newLink --> old first
      first = newLink;               // first --> newLink

      }    
//=============================================================================================== 
        public void display2() { 




        System.out.print("\t\t        *~...~*  The Menue *~...~*  \n\n"); 
        System.out.println("\n\tR.N.    ID              TEACHER NAME \t                PHONE NUMBER\n "); 
        Link current = first; // start at beginning of list 
        while (current != null) // until end of list, 
        { 
            current.displayLink2(); // print data 
            current = current.next; 
            // move to next link 
        } 
        System.out.println(""); 
      } 
    }     
//===============================================================================================

Class DoublyLinkedApp

//===============================================================================================
import java.util.Scanner;
import javax.swing.JOptionPane;
import javax.swing.JFrame; 

class DoublyLinkedApp
   {
   public static void main(String[] args)
      {                            

     DoublyLinkList theList = new DoublyLinkList();      
     Scanner input = new Scanner(System.in);

        int c=0;
        int a = 0; 
        int b = 0;        
        Link  f;

                theList.insertFirst(16, "08120014", "Ms. Fahmeeda Aziz","043258088");
                theList.insertFirst(15, "08120014", "Dr. Farhana Shaheen ","043258088");
                theList.insertFirst(14, "08120014", "Dr. Fatima Al-Zwaihri ", "043258088");
                theList.insertFirst(13, "08120014", "Dr. Tahani Sindi    ", "043258088"); 
                theList.insertFirst(12, "08120014", "Dr. Nagla Osman     ", "043935024"); 
                theList.insertFirst(11, "08120014", "Ms. Atiya Azmi      ", "043258088"); 
                theList.insertFirst(10, "08120014", "Ms. Aisha Al-Johani   ", "043258088");
                theList.insertFirst(9, "08120014", "Ms. Siti Haryani Mohd ", "043935024"); 
                theList.insertFirst(8,"08120014", "Ms.Humera Ghani     ", "043258088");
                theList.insertFirst(7, "08120014", "Ms. Salma Sadiqha    ", "043258088");
                theList.insertFirst(6, "08120014", "Ms. Azra Sultana     ", "043935024"); 
                theList.insertFirst(5, "08120014", "Ms. Ruchi Tuli     ", "043258088");
                theList.insertFirst(4, "08120014", "Ms. Fozia Noor   ", "043258088");
                theList.insertFirst(3, "08120014", "Ms. Kajal nusratullah  ", "043258088");
                theList.insertFirst(2, "08120014", "Ms.Anusuyah Subbarao  ", "043935024");
                theList.insertFirst(1, "08120014", "Ms. Aizal Yusrina ", "043258088");

        JOptionPane.showMessageDialog (null, "   *~...~*  WELCOME *~...~*\n\n  PHONE DIRECTORY SYSTEM\n\n    For Login Please Click Ok\n\n", " {ELECTRONIC SYSTEM OF PHONE DIRECTORY]", JOptionPane.INFORMATION_MESSAGE);
        JFrame frame = new JFrame();

        int SENTINEL = 123; //password number
        String str;  //password number which the user will Enter it
        int password = 0;
        int counter = 5;

       while (counter != 0 && password != SENTINEL)
       {     
        str = JOptionPane.showInputDialog("Enter Password");

        password = Integer.parseInt(str);

        if(password == SENTINEL)
        {
            JOptionPane.showMessageDialog(null, "CORRECT");
            System.out.println("\n\t*~...~* The Messages of PHONE DIRECTORY SYSTEM *~...~*\n\n-------------------------------------------------------------------------- \n");        
        }
        else if(password!=SENTINEL)
        {
             JOptionPane.showMessageDialog(null, "Wrong try again");
        }
        counter = counter-1;

        if (counter == 0)
        {
            JOptionPane.showMessageDialog(null, "Acces Denied!!! \nPlease contact Helpdesk");      
            System.exit(0);
        }
        }

     while(c!=6)
    {
      String Option1 = JOptionPane.showInputDialog(null,"\nPlease Enter The Number of Choice !? \n1) View list ROOM\n2) SEARCH THE DATA OF TEACHER\n3) Remove DATA OF TEACHER list\n4) Insert DATA OF TEACHER list\n5) Exit\n", "Phone Directory Options", JOptionPane.INFORMATION_MESSAGE);
           c = Integer.parseInt(Option1);

    // System.out.println("\nPlease Enter The Number of Choice !? \n1) View list ROOM\n2) SEARCH THE DATA OFTEACHER\n3) Remove DATA OF TEACHER list\n4) Insert DATA OF TEACHER list\n5) Exit\n");
  //    c=input.nextInt();

             switch (c) // 5 cases
       {
//===============================================================================================
       case 1: {

                theList.displayList();

                System.out.println("---------------------------------------------------------------------------\n");
                     }
       break;

//===============================================================================================   
    case 2: 
           System.out.println("\nEnter how MANY TEACHERS U WANT TO FIND");
            a=input.nextInt();

                  for(int j=1;j<=a;j++)
               {   
               System.out.println("\nEnter Number of Teacher Room   ÏÏ "+j+" ÏÏ ");
               b=input.nextInt();

               f = theList.find( b); 
                        // find item
               if(f!=null)
               {
             System.out.println("\nTEACHER NAME IS: "+f.Teacher_Name+"\nTEACHER ID: "+f.teacher_ID+"\nPHONE NUMBER IS: "+f.Phone_number);
             System.out.println("\n---------------------------------------------------------------------------\n"); 
               }
               else
               {
               System.out.println("we did FOUND "+f.Teacher_Name);  

               } 
                }
               break;

//===============================================================================================         
       case 3: {

          System.out.println("\nEnter THE ROOM NUMBER OF TEACHER  ");
          int key=input.nextInt();
          Link i = theList.delete(key);        // delete item
          if( i != null )
          {
           System.out.println("Deleted NUMBER OF ROOM : "+  i.Room_Number+"\n");
           System.out.println("Delet the ID :  "+i.teacher_ID +"\n");
           System.out.println("Delet the Name Of TEACHER : "+ i.Teacher_Name+"\n" );
           System.out.println("Delet the PHONE NUMBER :  "+i.Phone_number+"\n");      
           System.out.println("SUCCESSFUL DELET");
           theList.displayList();
           System.out.print("---------------------------------------------------------------------------\n");
          } 
          else
          {
          System.out.println("Can't delete ");      
          System.out.println("the data still in list "+i);

         //   theList.displayList();  
          }
          //System.out.print("---------------------------------------------------------------------------\n");
          } 
          break;
//===============================================================================================                   
       case 4: {   

          System.out.println("NEW NUMBER OF ROOM : ");
          int new1=input.nextInt();

           if(new1==a)   
          {     
           System.out.println("That Room Number Is currently in the list\n");       	
          }

          else

           System.out.println("THE ID FOR NEW TEACHER : ");
           String new2=input.next();

           System.out.println("NEW TEACHER NAME : ");
           String new3=input.next();

           System.out.println("PHONE NUMBER OF NEW TEACHER:  ");
           String new4=input.next();

           theList.insertLast(new1,new2, new3, new4);

           theList.display2();

          //theList.displayList();  
       	}
      	   break;

//===============================================================================================            	   
      	    case 5: 
      	    {
      	    	System.exit(0);
      	    }
      	     break;	

//===============================================================================================        	    	    	
    }
      if(c>6)
       {
    System.out.println("YOUAR INPUT NUMBER NOT IN THE LIST\nPLEASE, TRY AGAIN");   	
        }
      }     
  }      
}
//===============================================================================================

تم تعديل هذه المشاركة بواسطة طالبة مجتهدة 2012 في 23 ديسمبر 2012 في 12:56

#5

حاولت كثيييييييير بكل الانواع مااااا زبط

:( خلاص يعني ما في حل

مواضيع مشابهة