الموضوع: حل بروجكت cpcs203
عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 15-08-2011, 11:00 PM   #8

will smith

جامعي

 
تاريخ التسجيل: Feb 2010
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الخامس
الجنس: ذكر
المشاركات: 12
افتراضي رد: حل بروجكت cpcs203

أخوي يا ريت تشرح لي النقطتين ذي لاهنت

System.out.print("Insert the title name you are looking for: ");
String CD_title = input.nextLine();
int CD_title_index = -1;
for(int i = 0; i < CDs; i++)
{
if(CD_Collection[i].getTitle().equals(CD_title))
{
CD_title_index = i;
break;
}
}
if(CD_title_index == -1) System.out.println("no matched title.");
else
{
System.out.println("The title name matches the following CD's title name:");
System.out.println(CD_Collection[CD_title_index].toString());
}
break;



int rented_CDs = 0;
int rented_DVDs = 0;
for(int i = 1; i <= CDs; i++)
{
if(CD_Collection[i-1].getRented()) rented_CDs++;
}
for(int j = 1; j <= DVDs; j++)
{
if(CD_Collection[j-1].getRented()) rented_DVDs++;
}
System.out.println("The shop has " +
(rented_CDs == 0? "no rented CDs":rented_CDs == 1? "only one rented CD":rented_CDs + " rented CDs") +
" and " +
(rented_DVDs == 0? "no rented DVDs":rented_DVDs == 1? "only one rented DVD":rented_DVDs + " rented DVDs")
+ ".");
System.out.println();
System.out.println(".:Rented CDs Details:.");
int rented_CD_index = 1;
for(CD myCD : CD_Collection)
{
if(myCD.getRented())
{
System.out.println("CD#" + rented_CD_index + ":");
System.out.println(CD_Collection[rented_CD_index-1].toString());
rented_CD_index++;
}
}
System.out.println();
System.out.println(".:Rented DVDs Details:.");
int rented_DVD_index = 1;
for(DVD myDVD : DVD_Collection)
{
if(myDVD.getRented())
{
System.out.println("DVD#" + rented_DVD_index + ":");
System.out.println(DVD_Collection[rented_DVD_index-1].toString());
rented_DVD_index++;
}
}

وجزاك الله خير وما قصرت

 

will smith غير متواجد حالياً   رد مع اقتباس