موقع طلبة جامعة البحرين

يمكنك تصفح الموقع كزائر ولكن ندعوك لتسجيل عضوية خاصة بك لتحصل على كافة الصلاحيات مثل تنزيل ملفات المكتبة وقراءة تعليقات هيئة التدريس وغيرها. يمكنك الحصول على عضوية مجانية بالضغط على زر تسجيل. إذا قمت بالتسجيل مسبقا فيمكنك الضغط على زر دخول.

تسجيل دخول
  • قسم المكتبة الجامعية مغلق مؤقتا بعد الاستهداف التي تعرضت له بعض خدمات أمازون في البحرين، جاري استرجاع الملفات ونقلها إلى سيرفرات جديدة وسيتم بعدها اعادة افتتاح المكتبة

ITCS215 للفصل الدراسي الأول 2015 - 2016

شكراً شعب .. على راسي .. فهمت عليكم

بس ليحين ما انحلت المشكله هههههه خلوا الكود إلي سويته في البرنامج و شوفوا الإيرور

الإيرور في الـConstructor مال الـDerive Class .. ماعرف شنو فيه Error بالضبط

وقصدي استخدام الـgetbalance في الـDerive Class .. في Method for derive class

to check if the balance is less that service charges or not

if true then balance - service charges

if false then cout any sentence

so , how can i do it ?

is it like

getbalance()-servicecharges
or
banckAccount.getbalance()-servicecharges

او شنو ؟
 
عندك عدة أخطاء، عدلت عليها ع السريع وضفت جنبها تعليق
مسامحة ما اقدر اشرح الحين لضيق الوقت
PHP:
#include <iostream>
using namespace std;

class bankAccount
{
private:
   int number; // account number
   double balance;

 public:
   void setNumber(int n);
   void setBalance(double b);
   int getNumber();
   double getBalance();
   double deposit (double d);
   double withdraw(double w);
   void print();//print the account number and the balance
   bankAccount(int n, double b);
};

class checkingAccount:public bankAccount
{
    private:
        double Interest;
        double MinimumBalance;
        double ServiceCharges;
    public:
    void setInterest(double in);
    void setMinimumBalance(double mb);
    void setServiceCharges(double sc);
    double getInterest();
    double getMinimumBalance();
    double getServiceCharges();
    double checkBalance(double NB);
    void printcheckingBalance();
    checkingAccount(double in,double mb,double sc,int n,double b); //You cannot use bankAccount(n,b) inside the class, only outside.. Unless you want to implement it inside the class
};

bankAccount::bankAccount(int n,double b)
{
    number=n;
    balance=b;
}

void bankAccount::setNumber(int n)
{
    number=n;
}

void bankAccount::setBalance(double b)
{
    balance=b;
}

int bankAccount::getNumber()
{
    return number;
}

double bankAccount::getBalance()
{
    return balance;
}

double bankAccount::deposit(double d)
{
    //Changed..
    balance+=d;
    return balance;
}

double bankAccount::withdraw(double w)
{
    balance=balance-w;
    return balance;
}//It's better save the new value in the current balance.

void bankAccount::print()
{
    cout<<"The Account Number is: "<<number<<endl;
    cout<<"The Account Balance is: "<<balance<<endl;
}

void checkingAccount::setInterest(double in)
{
    Interest=in;
}

void checkingAccount::setMinimumBalance(double mb)
{
    MinimumBalance=mb;
}

void checkingAccount::setServiceCharges(double sc)
{
    ServiceCharges=sc;
}

double checkingAccount::getInterest()
{
    return Interest;
}

double checkingAccount::getMinimumBalance()
{
    return MinimumBalance;
}

double checkingAccount::getServiceCharges()
{
    return ServiceCharges;
}
//The Constructort will be like this
checkingAccount::checkingAccount(double in, double mb, double sc, int n, double b):bankAccount(n,b) //It's possible to add "bankAccount(n,b)" now
{
    Interest=in;
    MinimumBalance=mb;
    ServiceCharges=sc;
}
/*
double checkingAccount::checkBalance(double NB)
{
    if(getBalance()>ServiceCharges)
    {
        NB=getBalance()-ServiceCharges;
    }
    else return -1;

    return NB;
}
*/

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}


وهذا حلي، حليته من كم يوم تقدر تقارنه مع حلك
PHP:
#include <iostream>
using namespace std;
class bankAccount
{
public:
    void setNumber(int num);
    void setBalance(double num);
    int getNumber();
    double getBalance();
    void deposit (double d);
    void withdraw(double w);
    void print();//print the account number and the balance
    bankAccount(int n, double b);
private:
    int number; // account number
    double balance;
};
void bankAccount::setNumber(int num){number=num;}
void bankAccount::setBalance(double num){balance=num;}
int bankAccount::getNumber(){return number;}
double bankAccount::getBalance(){return balance;}
void bankAccount::deposit(double d){balance+=d;}
void bankAccount::withdraw(double w){balance-=w;}
void bankAccount::print(){
    cout<<"Account No.\t"<<number<<endl
        <<"Balance:\t"<<balance<<endl;
}
bankAccount::bankAccount(int n, double b)
{
    number=n;
    balance=b;
}


class checkingAccount : public bankAccount{
private:
    double interest;
    double minimumBalance;
    double serviceCharges;
public:
    //Set Functions
    void setInterest(double  );
    void setMiniBalance(double  );
    void setServiceCharges(double  );
    //Get Functions
    double getInterest();
    double getMiniBalance();
    double getServiceCharges();
    //Other Functions
    bool checkBalance();
    void print();
    checkingAccount(double, double, double, int, double);
};

void checkingAccount::setInterest(double INTEREST){interest=INTEREST;}
void checkingAccount::setMiniBalance(double MINIb){minimumBalance=MINIb;}
void checkingAccount::setServiceCharges(double SC){serviceCharges=SC;}
double checkingAccount::getInterest(){return interest;}
double checkingAccount::getMiniBalance(){return minimumBalance;}
double checkingAccount::getServiceCharges(){return serviceCharges;}
bool checkingAccount::checkBalance()
{
    setBalance(getBalance()-getServiceCharges());
    if(getBalance() < getMiniBalance())
        return true;
    else
        return false;
}
void checkingAccount::print(){
    bankAccount::print();
    cout<<"Interest:\t"<<getInterest()<<endl
        <<"Minimum Balance:\t"<<getMiniBalance()<<endl
        <<"Service Charges:\t"<<getServiceCharges()<<endl;
    /*
    It's possible to remove "bankAccount::" and just leave the function name as long as there are no
    other functions with same name, but in our case it's not possible (it will change into recursive function if we did it)
    */
}
checkingAccount::checkingAccount(double IN, double MB, double SCH, int Num, double BLS):bankAccount(Num, BLS)
{
    interest = IN;
    minimumBalance = MB;
    serviceCharges = SCH;
}

int main(){
    checkingAccount Test(500.000, 20.9, 15.500, 1250, 1000.000);
    Test.print();
    Test.checkBalance();
    Test.print();

    system("pause");
    return 0;
}
 
عندك عدة أخطاء، عدلت عليها ع السريع وضفت جنبها تعليق
مسامحة ما اقدر اشرح الحين لضيق الوقت
PHP:
#include <iostream>
using namespace std;

class bankAccount
{
private:
   int number; // account number
   double balance;

 public:
   void setNumber(int n);
   void setBalance(double b);
   int getNumber();
   double getBalance();
   double deposit (double d);
   double withdraw(double w);
   void print();//print the account number and the balance
   bankAccount(int n, double b);
};

class checkingAccount:public bankAccount
{
    private:
        double Interest;
        double MinimumBalance;
        double ServiceCharges;
    public:
    void setInterest(double in);
    void setMinimumBalance(double mb);
    void setServiceCharges(double sc);
    double getInterest();
    double getMinimumBalance();
    double getServiceCharges();
    double checkBalance(double NB);
    void printcheckingBalance();
    checkingAccount(double in,double mb,double sc,int n,double b); //You cannot use bankAccount(n,b) inside the class, only outside.. Unless you want to implement it inside the class
};

bankAccount::bankAccount(int n,double b)
{
    number=n;
    balance=b;
}

void bankAccount::setNumber(int n)
{
    number=n;
}

void bankAccount::setBalance(double b)
{
    balance=b;
}

int bankAccount::getNumber()
{
    return number;
}

double bankAccount::getBalance()
{
    return balance;
}

double bankAccount::deposit(double d)
{
    //Changed..
    balance+=d;
    return balance;
}

double bankAccount::withdraw(double w)
{
    balance=balance-w;
    return balance;
}//It's better save the new value in the current balance.

void bankAccount::print()
{
    cout<<"The Account Number is: "<<number<<endl;
    cout<<"The Account Balance is: "<<balance<<endl;
}

void checkingAccount::setInterest(double in)
{
    Interest=in;
}

void checkingAccount::setMinimumBalance(double mb)
{
    MinimumBalance=mb;
}

void checkingAccount::setServiceCharges(double sc)
{
    ServiceCharges=sc;
}

double checkingAccount::getInterest()
{
    return Interest;
}

double checkingAccount::getMinimumBalance()
{
    return MinimumBalance;
}

double checkingAccount::getServiceCharges()
{
    return ServiceCharges;
}
//The Constructort will be like this
checkingAccount::checkingAccount(double in, double mb, double sc, int n, double b):bankAccount(n,b) //It's possible to add "bankAccount(n,b)" now
{
    Interest=in;
    MinimumBalance=mb;
    ServiceCharges=sc;
}
/*
double checkingAccount::checkBalance(double NB)
{
    if(getBalance()>ServiceCharges)
    {
        NB=getBalance()-ServiceCharges;
    }
    else return -1;

    return NB;
}
*/

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}


وهذا حلي، حليته من كم يوم تقدر تقارنه مع حلك
PHP:
#include <iostream>
using namespace std;
class bankAccount
{
public:
    void setNumber(int num);
    void setBalance(double num);
    int getNumber();
    double getBalance();
    void deposit (double d);
    void withdraw(double w);
    void print();//print the account number and the balance
    bankAccount(int n, double b);
private:
    int number; // account number
    double balance;
};
void bankAccount::setNumber(int num){number=num;}
void bankAccount::setBalance(double num){balance=num;}
int bankAccount::getNumber(){return number;}
double bankAccount::getBalance(){return balance;}
void bankAccount::deposit(double d){balance+=d;}
void bankAccount::withdraw(double w){balance-=w;}
void bankAccount::print(){
    cout<<"Account No.\t"<<number<<endl
        <<"Balance:\t"<<balance<<endl;
}
bankAccount::bankAccount(int n, double b)
{
    number=n;
    balance=b;
}


class checkingAccount : public bankAccount{
private:
    double interest;
    double minimumBalance;
    double serviceCharges;
public:
    //Set Functions
    void setInterest(double  );
    void setMiniBalance(double  );
    void setServiceCharges(double  );
    //Get Functions
    double getInterest();
    double getMiniBalance();
    double getServiceCharges();
    //Other Functions
    bool checkBalance();
    void print();
    checkingAccount(double, double, double, int, double);
};

void checkingAccount::setInterest(double INTEREST){interest=INTEREST;}
void checkingAccount::setMiniBalance(double MINIb){minimumBalance=MINIb;}
void checkingAccount::setServiceCharges(double SC){serviceCharges=SC;}
double checkingAccount::getInterest(){return interest;}
double checkingAccount::getMiniBalance(){return minimumBalance;}
double checkingAccount::getServiceCharges(){return serviceCharges;}
bool checkingAccount::checkBalance()
{
    setBalance(getBalance()-getServiceCharges());
    if(getBalance() < getMiniBalance())
        return true;
    else
        return false;
}
void checkingAccount::print(){
    bankAccount::print();
    cout<<"Interest:\t"<<getInterest()<<endl
        <<"Minimum Balance:\t"<<getMiniBalance()<<endl
        <<"Service Charges:\t"<<getServiceCharges()<<endl;
    /*
    It's possible to remove "bankAccount::" and just leave the function name as long as there are no
    other functions with same name, but in our case it's not possible (it will change into recursive function if we did it)
    */
}
checkingAccount::checkingAccount(double IN, double MB, double SCH, int Num, double BLS):bankAccount(Num, BLS)
{
    interest = IN;
    minimumBalance = MB;
    serviceCharges = SCH;
}

int main(){
    checkingAccount Test(500.000, 20.9, 15.500, 1250, 1000.000);
    Test.print();
    Test.checkBalance();
    Test.print();

    system("pause");
    return 0;
}

تسلم حبوب ماتقصر .. ملاحظات بسيطه فتحت ذهني على شغلات وايد

و بخصوص فنكشن الديبوست .. انا ابالي اخلي اليوزر يدخل القيمه إلي يبي يدخلها فالبلنس = ديبوسب + بلنس وراح يسوي ريترن للديبوست

..

ألف شكر لك :msn-wink:
 
تسلم حبوب ماتقصر .. ملاحظات بسيطه فتحت ذهني على شغلات وايد

و بخصوص فنكشن الديبوست .. انا ابالي اخلي اليوزر يدخل القيمه إلي يبي يدخلها فالبلنس = ديبوسب + بلنس وراح يسوي ريترن للديبوست

..

ألف شكر لك :msn-wink:

نسيت اخبرك .. مادري اشتغل عندك الكود ولا لا بس عندك جم خطأ .. :nosweat:

المهم انا عدلت الأخطاء إلي في الكود مالي والحمد لله اشتغل وضفت عليه دم شغله بعد

PHP:
#include <iostream>
using namespace std;

class bankAccount
{
private:
   int number; // account number
   double balance;

 public:
   void setNumber(int n);
   void setBalance(double b);
   int getNumber();
   double getBalance();
   double deposit (double d);
   double withdraw(double w);
   void print();//print the account number and the balance
   bankAccount(int n, double b);
};

class checkingAccount:public bankAccount
{
    private:
        double Interest;
        double MinimumBalance;
        double ServiceCharges;
    public:
    void setInterest(double in);
    void setMinimumBalance(double mb);
    void setServiceCharges(double sc);
    double getInterest();
    double getMinimumBalance();
    double getServiceCharges();
    double checkBalance(double NB);
    void printcheckingBalance();
    checkingAccount(double in,double mb,double sc,int n,double b);
};

bankAccount::bankAccount(int n,double b)
{
    number=n;
    balance=b;
}

void bankAccount::setNumber(int n)
{
    number=n;
}

void bankAccount::setBalance(double b)
{
    balance=b;
}

int bankAccount::getNumber()
{
    return number;
}

double bankAccount::getBalance()
{
    return balance;
}

double bankAccount::deposit(double d)
{
    cout<<"Enter An Amount To Deposite: ";
    cin>>d;
    while(d<0)
    {
        cout<<"Invallid!!, Re-Enter: ";
        cin>>d;
    }
    balance=balance+d;
    return balance;
}

double bankAccount::withdraw(double w)
{
    cout<<"How Much do you want to withdraw?: ";
    cin>>w;
    while(w>balance || w<0)
    {
        cout<<"Error!!, Enter an amount again: ";
        cin>>w;
    }
    balance=balance-w;
    return balance;
}

void bankAccount::print()
{
    cout<<"The Account Number is: "<<getNumber()<<endl;
    cout<<"The Account Balance is: "<<getBalance()<<endl;
}

checkingAccount::checkingAccount(double in,double mb,double sc,int n,double b):bankAccount(n,b)
{
    Interest=in;
    MinimumBalance=mb;
    ServiceCharges=sc;
}

void checkingAccount::setInterest(double in)
{
    Interest=in;
}

void checkingAccount::setMinimumBalance(double mb)
{
    MinimumBalance=mb;
}

void checkingAccount::setServiceCharges(double sc)
{
    ServiceCharges=sc;
}

double checkingAccount::getInterest()
{
    return Interest;
}

double checkingAccount::getMinimumBalance()
{
    return MinimumBalance;
}

double checkingAccount::getServiceCharges()
{
    return ServiceCharges;
}


double checkingAccount::checkBalance(double NB)
{

    if(getBalance()>ServiceCharges)
    {
        NB=getBalance()-ServiceCharges;
    }
    else return -1;

    return NB;
}

void checkingAccount::printcheckingBalance()
{
    bankAccount::print();
    cout<<endl;
    cout<<"The Interest is: "<<getInterest()<<endl;
    cout<<"The Services Charges is: "<<getServiceCharges()<<endl;
    cout<<"The Minimum Balance is: "<<getMinimumBalance()<<endl;
}

int main()
{

    checkingAccount C(10.2,2.0,20.4,2034,90.9);
    C.printcheckingBalance();
    cout<<endl;


    return 0;
}

الـOutput

PHP:
 
لوسمحتو الى عنده نوتات دكتور احمد فهد يصورهم
انا ويا دكتور راكيش ومضيعة مافهم عليه كلش
الانهرتنس والكوبيزشن درستهم بروحي وتعبت
الي يقدر يشرح لنا حتى لو باوراق ويصورهم بالتلفون ويحملهم بالموقع
جزاكم الا الف خير انقذو الي بيروحون فيها :icon1366:
 
لوسمحتو الى عنده نوتات دكتور احمد فهد يصورهم
انا ويا دكتور راكيش ومضيعة مافهم عليه كلش
الانهرتنس والكوبيزشن درستهم بروحي وتعبت
الي يقدر يشرح لنا حتى لو باوراق ويصورهم بالتلفون ويحملهم بالموقع
جزاكم الا الف خير انقذو الي بيروحون فيها :icon1366:

سلايدات يوسف حراث تماام .. وينفهم اليهم بسرعة
نزليهم من مكتبة الملفات ..
 
الصفحة الأولى بهذا الموضوع فيه شرح عن الـTemplates
 
التمبلت باختصار اذا تبين تسوين فانكشن او او فاريبل في كلاس ، بدون ما تحددين شنو نوعه (int or flout or string or... ) ، لانه المستخدم بعدين راح يحدد حسب استخدامه ، ،، تخلين النوع type ، و قبل الكلاس او الفانكشن لازم تكتبين templete <class type> l :smile2:
 
في احد فهم شنو المطلوب من الآسايمنت الأول للدكتور نبيل ؟؟؟
 


ممكن مساعدة في السؤال :RpS_crying:

    1. [*=left]Declaration two orderedLinkedListType objects named list1 and list2 to handle double numbers.
      [*=left]Insertion the following items in list1: 1.9, 2.3, 2.7, 3.1, and 3.6
      [*=left]Insertion the following items in list2: 2.1, 2.4, 2.9, and 3.2
      [*=left]Printing the elements of list1 and list2.
Question
2.[FONT=&quot] [/FONT]Use the following class operation to the class orderedLinkedListType:​
void mergeLists(orderedLinkedListType<Type> &list1,​
orderedLinkedListType<Type> &list2);​
This operation creates a new list by merging two ordered lists: list1 and list2. The new list is also ordered.​
Assume that class orderedLinkedListType is available for use.

 
موضوعكم مايصحش

وين النشاطء ياجماعة .. وين طلبه 102 - 104

شحلاوته كان ذاك الموضوع اللكورس إلي راح

نبغي هالكورس نفس الشي ويا هالماده ..

يعطيكم العافيه
 
شباب ممكن مساعدة في هذا
أبي أجيك الحل اتوقع انه ناقص بعد :RpS_unsure:

Write a function called merge that accepts two array-based lists
list1 and list2 of type arrayListType as parameters. Elements of
list1 are sorted in ascending order.

Whereas,the elements of list2 are not sorted. The function should
insert the elements of list2 in list1 in such a manner that after
insertion also list1 remains sorted.

Assume that class arrayListType is available for use.

Function prototype:



template<class elemType>

bool merge(arrayListType<elemType> &list1,
const arrayListType<elemType> &list2);

Note that the function returns false if both lists list1
and list2 are empty or if list1 becomes full at any stage,
else returns true.



PHP:
template<class elemType>

bool merge(arrayListType<elemType> &list1,
const arrayListType<elemType> &list2);
{
   type elem,item

   if(list1.isEmpty() && list.isEmpty() && list.isFull() )
    
   return false;
   
   for(int i=0 ; i<list1.listsize() || i<list2.listsize() ; i++)
   {
      
      item=list2.retriveAt(i,elem);
      list1.inseartAT(item);
   
   }
    return true
}
 
هذا السؤال بعد أبي أحد يوضحه لي وبحاول احله

write a function not a member function called arenge list that accepts tow array listtype objects called L1 and L2 as a parameters .

the function insearts in L1 all elements of L2 in reverse order The function then removes the duplicate elements
 
بسم الله الرحمن الرحيم

اللهم صلِّ و سلم على محمد و آل محمد


السلام عليكم و رحمـة الله.. :smile:


طبعا هذا موضوع للدراسة والمناقشة والتعاون الطلابي في دراسة مقررITCS215
..




إي سؤال ,إي أستفسار حياكم هنا..
:99:

أهلا بكم جميعا ً,,
:shiny:
 
معاكم إن شاء الله ..
بالتوفيق
 
ممكن احد يصورلي الاوت لاين الخطة الدراسية .. الصفحتين ورا وقدام .. وشكرا مقدماً :99::blushing:
 
وين التفاعل من الطلاب ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
 
اني ويا دكتور راكيش >>> خوش دكتور :RpS_love::RpS_love:

وصلنا لحد ال inheritance

which is linking two classes together without changing in the main class
:smile2::smile2:
 
في أحد فاهم سالفة الـ Composition ؟ :99:
 
عودة
أعلى أسفل