OOP 2008/2009 Practical : Model 4 & 5 Soltion

on Thursday, January 7, 2010

model answer of test 4,5 2008/2009 practical exam
note test 4 c : ma3reftesh egabetha yareet el ye3raf ye2ool
rabenna ywafa2 el kol

13 comments:

TheDrkFR_91 said...

3ala fekra dh 7l part 4 (c)

TheDrkFR_91 said...

class mobile
{
public string model;
public static int number=10000;
public mobile(string model)
{
this.model = model;
number++;
}
public static int Number
{
get
{
return number;
}
}
public void detail(string s)
{
s = model;
Console.WriteLine("mobile model is {0}", s);
Console.WriteLine("mobile number is {0}", number);
}


}


//main class

static void Main(string[] args)
{
mobile n1 = new mobile("nokia");
n1.detail("nokia");
mobile n2 = new mobile("samsung");
n2.detail("samsung");
}

mohanad mohamad said...

thx geddan 3ala maghodak bas ana 3ayez afham el fekra kolaha fel propertie la2en ana 3amalt nafs el kalam da men gheer el propertie we kan beyedy kema wa7da le kol el objects
el so2al en el propertie bas heya el fara2et??
w thx geddan any way 3ala maghoodak

mohanad mohamad said...

we fel method detail mesh me7tag ennak to7ot feha string s
el a7san
public void detail()
{
console.writeline("mobile model : "+model);
console.writeline("mobile number : "+number);
}

TheDrkFR_91 said...

bel nesba ll propirites hya de 3alashan t2aked en mayenfa3sh an ay 7d yegayar fe al mobile number ya3ny al sherka hwa ally hat7ot al mobile no. zy mahy 3ayza ( zy al so2al ma talep) .ya3ny aywa hwa al properties hya ally hatefre2 fe al 7ala de.
we belnesbaa ll methode fa de 3andak 72
we beltawfee2 isA

TheDrkFR_91 said...

3ala fekra ya mohanad al pernameg mmkn bardw yeshtagal bnafs al tare2a b2nak t3ml al mobile number private we kda mmkn testagna 3n al properties ya3ny yeb2a kda
class mobile
{
public string model;
private static int number=10000;
public mobile(string model)
{
this.model = model;
number++;
}

public void detail()
{

Console.WriteLine("mobile model is {0}", model);
Console.WriteLine("mobile number is {0}", number);
}


}

mohanad mohamad said...

thx 3ala maghodak bas ana hatganen men enny 3amalt el taree2a el tanya de we mashtaghalsh kan beye3mel initialize kol mara lel number bel value el 7atetha bara el constructor
we ba3deen a2olo number ++; kan beye3mel nafs el vales lekol el objects be 1000001.
thx any way el mohem ennaha eshtaghalet
:D:D

TheDrkFR_91 said...

2t2aked enak kont 3aml mobile number static l2n da hwa al mohem fe al tar2teen

TheDrkFR_91 said...

bs lw anta 3amaltaha bel tare2a dee kda lw geet fe al main we nadeet tane 3ala n1 b3d n2 hayetba3lak esm n1 we rakam n2 fa dee lazem tet3ml kda
public string model;
{
private int number = 100000;
public static int i = 1;

public mobile(string model)
{
this.model = model;
number = number + i;
i++;

}
public void detail()
{

Console.WriteLine("mobile model is {0}", model);
Console.WriteLine("mobile number is {0}", number);
}
thnx to kareem azzurie 3alashan hwa ally nabehny leha we bltawfee2 isA

mohanad mohamad said...

thx geddan mesh 3aref a2olak eh

Anonymous said...

wallhi ya gam3a ye3eni ana mostshaker gedan gedan....rbna yega3lo fe mezan 7asntko we yekremko

Anonymous said...

يا جماعة لو سمحتوا عايزين حد يشرح
Journal,Ledger,Trial balance
لان احنا بجد ضايعين فى الجزء دة
وشكرا على مجهوداتكم
ويارب اللى بيعمل حاجة ينجح بتقدير
وادعولنا

نور الإسلام said...

بجد ربنا يجازيك خير عننا
وكتر الف خيرك على المجهود ده كله وربنا يجعله في ميزان حسناتك ويوفقك وتكون من الاوائل بإذن الله ويوفق الجميع

Post a Comment