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

كيف احول كود الى برنامج حقيقي

بدأه الطالبه بنان في 7 نوفمبر 2011 · 7 رد · 3,233 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

استفساري هو: هل من الممكن تحويل كود مكتوب بلغة الجافا باستخدام محرر JCreator الي برنامج حقيقي

((أو كيف استطيع تطوير كود بلغة الجافا واجعله برنامج صالح للاستخدام)))

import java.util.Calendar;
import java.util.Scanner;
class Link
   {
  public int ID;
   public int qui;
   public String Items;
   public int price;           // data item
   public Link next;              // next link in list
// -------------------------------------------------------------
   public Link(int a,int b,String Ite, int p)           // constructor
      { ID = a; 
      qui=b;                             // constructor
      Items = Ite;
      price = p;

       }                           //  set to null)
// -------------------------------------------------------------
  public void displayLink1() 
       // display ourself
      { 


      System.out.println("\t"+Items+"\t\t{"+price+"}");

      System.out.println(""); 
      }

      public void displayLink2() 
       // display ourself
      { 
      System.out.print("\t"+ID);
      System.out.print("\t"+ qui);

      System.out.print("\t"+Items);

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


   } 
////////////////////////////////////////////////////////////////
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 void insertFirst(int ID,int SD, String Item, int pri)
      {                           // make new link
      Link newLink = new Link(ID,SD, Item, pri);
      newLink.next = first;       // newLink --> old first
      first = newLink;            // first --> newLink
      }
// -------------------------------------------------------------
public Link find(int key)      // find link with given key
      {                           // (assumes non-empty list)
      Link current = first;              // start at 'first'
      while(current.ID != 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.ID != 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 displayList1()
      {
      	System.out.println("\t\t*********** Welcome ***********");
      System.out.print("\n\n\t\tThe Menue Of our Canteen \n\n");
      System.out.println("\n\t ææItem name ææ\t\tææ price ææ");
      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 displayList2()
      {
      System.out.print("\t\täää The Menue Of our Canteen äää \n\n");
       System.out.println("\n\tID\tQuin\tItem name \t\t\tprice " );
      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
////////////////////////////////////////////////////////////////
class LinkListApp
   {
   public static void main(String[] args) 
      {
      LinkList theList = new LinkList();  // make new list



           int t=0;
           int e=0;
           int a=0;
           int b=0;
           theList.insertFirst(33,20,"bananas milk    ",2);
           theList.insertFirst(32,20,"strawberry milk ",2);
           theList.insertFirst(31,70,"chocolate milk  ",2);
           theList.insertFirst(30,42,"fresh juice     ",4);
           theList.insertFirst(29,22,"lemon juice     ",3);
           theList.insertFirst(28,50,"mirinda  orange ",2);
           theList.insertFirst(27,66,"mirinda apple   ",2);
           theList.insertFirst(26,70,"coca-cola       ",2);
           theList.insertFirst(25,60,"mango juice     ",3);
           theList.insertFirst(24,78,"strawberry juice",1);
           theList.insertFirst(23,50,"tissue          ",1);
           theList.insertFirst(22,20,"cheese cake     ",8);
           theList.insertFirst(21,22,"spinach pie     ",3);
           theList.insertFirst(20,23,"pizza           ",3);
           theList.insertFirst(19,40,"popcorn         ",3);
           theList.insertFirst(18,25,"ice coffee      ",8);
           theList.insertFirst(17,33,"ice juice       ",3);
           theList.insertFirst(16,20,"turkish coffee  ",6);
           theList.insertFirst(15,35,"french coffee   ",7);
           theList.insertFirst(14,30,"coffee          ",3);
           theList.insertFirst(13,43,"tea with milk   ",2);
           theList.insertFirst(12,50,"tea             ",1);
           theList.insertFirst(11,67,"code red        ",3);
           theList.insertFirst(10,70,"bison           ",3);
           theList.insertFirst(9,115,"pepsi           ",2);
           theList.insertFirst(8,87,"orange juice     ",1);
           theList.insertFirst(7,33,"doughnut         ",4);
           theList.insertFirst(6,22,"thyme pie        ",3);
           theList.insertFirst(5,54,"cheese pie       ",2);
           theList.insertFirst(4,44,"moka             ",7);
           theList.insertFirst(3,32,"cappuccino       ",3);
           theList.insertFirst(2,55,"Burger           ",5);
           theList.insertFirst(1,40,"french fries     ",3);





                theList.displayList1();


     Scanner input=new Scanner(System.in);

     String password;
     System.out.println( "Please enter your password ");
     do
     {


      password=input.nextLine();
     if(password.equals("hello"))

     System.out.println("correct\n");

     else
     {
     	System.out.println("wrong");
     	System.out.println("pleas tray again");
     }



	}while(!password.equals("hello"));



                  // display list
        // end main()



      while(true)
         { System.out.println("\nEnter number to:\n");
         System.out.println("1)show the minu for seller\n ");
         System.out.println("2)selecte the name of items and calculating the price\n");
         System.out.println("3)delet items after the order  \n");
         System.out.println("4)display the invoice\n");

         int num=input.nextInt();       // get user's option
         switch(num)
            {

            case 1:                    // show list
               if( !theList.isEmpty() )
                  theList.displayList2();
               else
                  System.out.println("List is empty");
               break;

                case 2:                    
              // search //caculate totale


               System.out.println("Enter how many items u want ");
               a=input.nextInt();


               for(int j=1;j<=a;j++)
               {
               System.out.println("\nEnter item ÏÏ "+j+" ÏÏ \n\n");
                 b=input.nextInt();

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

               System.out.println("yes we have "+f.qui+"  Items from  "+f.Items);
                 e= f.qui-1;
                 System.out.println("\nQuintity of "+f.Items+" Now is "+e);
                 t+= f.price;
                 }
               else
               {


               System.out.println("we did not have  "+f.Items);

                } 
                }

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


                  break;

           case 3:
           //delet



          System.out.println("Enter ID of Items to deldt ");
          int key=input.nextInt();
          Link i = theList.delete(key);        // delete item
          if( i != null )
          {

           System.out.println("Deleted the ID of number "+  i.ID+"\n");
           System.out.println("Delet the cuintitiy is = "+i.qui +"\n");
           System.out.println("Delet the Name Of Item "+ i.Items+"\n" );
           System.out.println("Delet the Price "+i.price+"\n");
           t-=i.price;

          System.out.println("price after delet"+t);
          } 
          else
          {

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

          t-=i.price;

          System.out.println("price after delet"+t);
}
          System.out.println("Do you want to delen other items:enter 1 to delet no press 0 ");  
          int s=input.nextInt();
          if(s==1)
          {

          System.out.println("Enterthe number of item to delet");
          int g=input.nextInt();
          Link q = theList.delete(g);        // delete item
          if( q != null )
          {

           System.out.println("Deleted the ID of number "+  q.ID+"\n");
           System.out.println("Delet the cuintitiy is = "+q.qui +"\n");
           System.out.println("Delet the Name Of Item "+ q.Items+"\n" );
           System.out.println("Delet the Price "+q.price+"\n");
          t-=q.price;
          System.out.println("price after delet ="+t);
          }
          else
          {

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

             }
             }
          else
          if(s==0) 
          {

          System.out.println("*******************");
          }



          break;



           case 4:
           {

          System.out.println("\t\n\n***********Sucess canteen ************ \n\n" ); 
       String months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
        "Sep", "Oct", "Nov", "Dec" };

    Calendar calendar = Calendar.getInstance();

    // Display current time and date information.
    System.out.print("Date: ");
    System.out.print(months[calendar.get(Calendar.MONTH)]);
    System.out.print(" " + calendar.get(Calendar.DATE) + " ");
    System.out.println(calendar.get(Calendar.YEAR));

    System.out.print("Time: ");
    System.out.print(calendar.get(Calendar.HOUR) + ":");
    System.out.print(calendar.get(Calendar.MINUTE) + ":");
    System.out.println(calendar.get(Calendar.SECOND));

    // Set the time and date information and display it.
    calendar.set(Calendar.HOUR, 10);
    calendar.set(Calendar.MINUTE, 29);
    calendar.set(Calendar.SECOND, 22);

    System.out.print("Updated time: ");
    System.out.print(calendar.get(Calendar.HOUR) + ":");
    System.out.print(calendar.get(Calendar.MINUTE) + ":");
    System.out.println(calendar.get(Calendar.SECOND));



           Link f = theList.find( b); 


           System.out.println("ÒÒYou buying ÏÏ "+a+" ÏÏ Item ÒÒ Is "+f.Items);



       System.out.println("\n ÒÒ Total Of The price ="+t);

      System.out.print("\t\n\n&&&&&&&&&&&&&&&&&&&&&\n\n");
      System.out.println("\t\nThank you     Come agine!!\n" );   
         }  
           break;
           default:
               System.out.println("Thank You For Comming");
            }  // end switch
         }  // end while
      }  // end main()
//--------------------------------------------------------------

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

تم تعديل هذه المشاركة بواسطة الطالبه بنان في 7 نوفمبر 2011 في 13:56

410602433.gif
#2

وعليكم السلام

يجب عليك تحويل البرنامج الى صيغة ال JAR

الرجاء مراجعة هذا الرابط ، يوجد شرح لعمل JAR file فى برنامج ال JCreator

Creating an Executable Jar File

#3

السلام عليكم ...

بعد تحويله لملف jar ... نعطيه للعميل و يقوم بتنفيذه باستخدام الأمر

java -jar myjarFile.jar

حيث myjarFile.jar هو اسم ملف الــ jar خاصتنا .. بشرط ان يكون الــ main-class موضوع بشكل صحيح ..

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

يمكن عمل exe له .. باستخدام ..launch4j و هو عبارة عن Cross-platform Java executable wrapper

http://launch4j.sourceforge.net

تم تعديل هذه المشاركة بواسطة houssam11350_11350 في 8 نوفمبر 2011 في 09:00

لا إله إلا الله ... محمد رسول الله

لو كانت مشاركتي مفيدة و تريد تشجيعي على المزيد من العطاء , فضلا قم بتقييم المشاركة

المعرًف القديم : houssam11350_11350

من مواضيعي : ArabGenCode : مولد كود و إجراءات مخزنة و واجهات لجداول سيكوال سيرفر

#4

لو كنت تستخدم برنامج NetBeans يمكنك عمل الـ jar من خلال البرنامج بسهوله

اختار من projects ثم اختار المشروع الخاص التى تود عمل الـ jar افتح قائمه على

المشروع واختار clean and build ثم توجه الى المكان الخاص بالمشروع

ستجد ان الـ jar موجوده داخل ملف اسمه dist

هذا بكل سهوله مع NetBeans

1
73b14eadba.gif

الحمدلله والصلاة والسلام على رسول الله وعلى آله وصحبه أجمعين

لكل مبتدئى البرمجه برمجه بلغه السى شارب

تنصيب ويندوز 8 على vmware

#5

شكرا ع الرد بس سؤال

كيف احول الكود من الجكريتر الى netBeans????

تم تعديل هذه المشاركة بواسطة الطالبه بنان في 20 نوفمبر 2011 في 23:19

410602433.gif
#6

ده برنامج كنت بستخدمه من فترة بس كويس جدا وبسيط خالص ف التعامل اسمه java installer تحميل البرنامج تحياتى :)

سأل الممكن المستحيل : أين تقيم ؟ فأجابه في أحلام العاجز

----------------------------------------

نمضى النصف الأول من حياتنا بحثاً عن المال والنجاح والشهرة ونمضى

النصف الثانى منها بحثاً عن الأطباء

-----------------------------------------

شخصٌ يرى ذا الكون وهو جالسٌ ويجوب هذي الأرض بين الدول

#7

انا لم اتعامل مع الـ J Creator من قبل ولكن اعتقد انه نفس الكود بنفس الطريقه لو تعرف برمجه اكيد هتقدر تنقله ولو معرفتش ضيف كومنت وانا اساعدك فى نقله

73b14eadba.gif

الحمدلله والصلاة والسلام على رسول الله وعلى آله وصحبه أجمعين

لكل مبتدئى البرمجه برمجه بلغه السى شارب

تنصيب ويندوز 8 على vmware

#8
الطالبه بنان كتب:

شكرا ع الرد بس سؤال

كيف احول الكود من الجكريتر الى netBeans????

من وجه نظرى يجب فهم كيفية عمل ملف ال JAR بعدها يمكن عمل ملف JAR باستخدام اى محرر او بدون إستخدام محرر

استخدام محرر مثل ال NETBEANS OR JCreator ليس المهم ، لكن من الافضل اولاُ فهم عملية عمل JAR

http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

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