• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 2 من 2

    الموضوع: ساعدوني

    1. #1
      التسجيل
      10-03-2005
      المشاركات
      46
      المواضيع
      31
      شكر / اعجاب مشاركة

      ساعدوني

      السلام عليكم
      ابي مساعدة في حل السؤال الخامس من الواجب الثاني لان عليه 20 درجة وانا محتاجة كل درجة شان اعدي الكورس لان ضيعت وايد درجات بالواجب والكويز (موجود بالملف المرفق ملف كبير هو
      ( 28,29,صفحة 27TMA02


      الاسئلة أطلب المساعدة فيها هي بس الي نغير فيها الكلاس حسب المطلوب يعني
      (i)(a)-(ii)(a)-(iii)(a
      )


      اول كلاس(a)(ii)
      import java.io.*;

      public class Simulate {

      public static void main(String [] args) {

      // **************************************
      // The code to create the tunnel
      // should be placed here
      // **************************************



      // ***************************************
      // The code to create two trams
      // (the threads)
      // should be placed here
      // ***************************************



      // **************************************
      // The code to and start the threads
      // executing should be placed here
      // **************************************



      }

      }






      ثاني كلاس (a)(ii)
      public class Tram extends Timer implements Runnable {

      private int id; // id identifies each tram
      private Tunnel tunnel; // a reference to the tunnel

      public Tram (int id, Tunnel tunnel) {
      // each tram has a different identifing number
      this.id = id;
      this.tunnel = tunnel;
      }

      public void run () {
      // each tram makes 3 loops of the track
      for (int j = 0; j < 3; j++) {
      System.out.println (spaces(id) + "Tram " + id + " leaves Depot");
      travel (10, id); // tram travels 10 units of distance from Depot to first stop
      System.out.println (spaces(id) + "Tram " + id + " arrives at stop");
      stop (5); // tram waits at first stop for 5 time units

      travel (15, id); // tram travels 15 units of distance from first stop to tunnel
      System.out.println (spaces(id) + "Tram " + id + " arrives at tunnel");

      tunnel.useTunnel (this); // the tunnel is used by the tram represented by 'this'

      travel (15, id); // tram travels 15 units of distance from tunnel to second stop
      System.out.println (spaces(id) + "Tram " + id + " arrives at stop");
      stop (5); // tram waits at second stop for 5 time units

      travel (10, id); // tram travels 10 units of distance from second stop to Depot
      System.out.println (spaces(id) + "Tram " + id + " arrives at Depot");
      stop (10); // tram waits at depot for 10 time units
      }
      System.out.println(spaces(id) + "Tram " + id + " out of service");
      }

      public int getId () {
      return id;
      }

      private String spaces (int id) {
      if (id == 1) return "" ;else return "\t";
      }

      }










      ثالث كلاس(a)(iii)




      public class WaitingRoom {

      private boolean passengersWaiting = false;

      public void setPassWaiting () {
      // ******************************
      // add synchronization code here
      // ******************************
      }

      public void getPassWaiting (int id) {
      try {
      // ******************************
      // add synchronization code here
      // ******************************
      } catch (InterruptedException e) {System.exit (0);}
      }

      private String spaces (int id) {
      if (id == 1) return ""; else return "\t";
      }
      }



      وكلاس
      public class Bus extends Timer implements Runnable {

      private WaitingRoom waitingRoom; // a reference to the waiting room

      public Bus (WaitingRoom waitingRoom) {
      // each tram has a different identifing number
      this.waitingRoom = waitingRoom;
      }

      public void run () {
      // bus makes 10 journeys
      for (int j = 0; j < 10; j++) {
      System.out.println ("\t\tBus leaves Depot");
      travel (30, 1); // Bus travels 30 units of distance from Depot to Airport
      System.out.println ("\t\tBus arrives at airport");
      stop (10); // Bus waits at stop for 10 time units
      travel (30, 1); // Bus travels 30 units of distance from Airport to Depot
      System.out.println ("\t\tBus arrives at Depot");
      stop (10); // Bus waits at depot for 10 time units
      // ******************************************
      // add conditional synchronization code here
      // ******************************************
      }
      System.out.println ("\t\tBus out of service");
      }

      }
      الملفات المرفقة الملفات المرفقة

    2. #2
      الصورة الرمزية AMTORNADO
      AMTORNADO غير متصل عضو مميز في منتدى السيارات
      رايق
       
      التسجيل
      31-05-2005
      المشاركات
      422
      المواضيع
      32
      شكر / اعجاب مشاركة

      مشاركة: ساعدوني

      أنا عايز اعرف إنتي عايزه حل أسئله المشاركه إلي راحت ولا المشاركه دي ولا الإتنين بس ياريت تحددي بسرعه ....


    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •