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

[تنبيه - عنوان غير مناسب : ]خطا في البرنامج..مين يساعدني فيه

بدأه Ali_Aus في 31 مارس 2011 · 2 رد · 339 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

انا بحاول اضيف هالمثود للاخير حسب ماهو مطلوب مني في الكوندشن سي بس ما عرفت يف اطلق طريقة true or fale والتعديل باخر الموضوع وانا محدد لعيه بلون احمر وهذا هو المطلوب

Condition is an interface that contains a single method that returns true or false.

// The Boats returned are those for which the method returns true when it is applied to them.

// Include thorough testing code in the main method.

وهذا الكود كامل

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package mytask6;

import fahad_task16.Boat;

import java.util.ArrayList;

import java.util.ArrayList;

import java.util.Collections;

import java.util.Comparator;

import java.util.concurrent.locks.Condition;

/**

*

* @author M

*/

public class BoatRegister {

ArrayList<Boat> regArray= new ArrayList<Boat>();

public void addBoat(Boat boat){

regArray.add(boat);

}

public Boat getBoat(int seqNo){

Boat ex = null;

for(Boat temp : regArray){

if(temp.getSeqNUMBER()==seqNo){

ex=temp;

}

}

return ex;

}

@Override

public String toString(){

String temp="";

for(Boat a : regArray)

temp =temp+"\n"+ a;

return temp;

}

public Boat deleteBoat(int seqNo){

Boat ex = null;

for(Boat temp : regArray){

if(temp.getSeqNUMBER()==seqNo){

int x = regArray.indexOf(temp);

ex=temp;

regArray.remove(x);

return ex;

}

}

return ex;

}

public ArrayList<Boat> getBoatsWhoseNameContains(String charSequence){

ArrayList<Boat> col=new ArrayList<Boat>();

for(Boat a : regArray){

if(a.getName().equals(charSequence)){

col.add(a);

}

}

return col;

}

public void GroupByClass(){

if(!regArray.isEmpty()){

Collections.sort(regArray, new Comparator(){

public int compare(Object o1, Object o2) {

Boat b1 = (Boat) o1;

Boat b2 = (Boat) o2;

return b1.getbClass().compareToIgnoreCase(b2.getbClass());

}

});

}

}

public ArrayList<Boat> getByCondition(Condition c){

ArrayList<Boat> a = new ArrayList<Boat>();

return a ;

}

interface condition

{ boolean satify)boat);

}

}

#2

الكود غير كامل

لعدم وجود الكلاس Boat

وايضا السوال غير مفهوم ما هو الخطأ بالظبط

Software Developer
Mahmoudkelany.com


 

#3

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته

مرحباً بكم في منتدى الفريق العربي للبرمجة

نود تنبيهك أن العنوان غير مناسب.

الرجاء اختيار عنوان مناسب أكثر في مواضيعك القادمة، وهذا بمثابة إشعار للأهمية.

وفي حال التكرار سيتعرض موضوعك للإغلاق والحذف!!!

قواعد المشاركة

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…