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

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

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

ITCS112 - ITCS104 - ITCS102 للفصل الصيفي 2014 - 2015

السلام عليكم شباب
الي عنده آخر سؤال assigmnt مال اللاب يحط الي السؤال والاجابة
كانوا موجودين عندي في الفلاش وصادها فايروس اضطريت أفرمتها وطار كل شي
 
التعديل الأخير:
سلام عليكم شعب ,,

شنو وظيفة Staric سواء كانت في Data member or member Functions؟؟​
 
ممكن حل الاسايمنت ماعليكم امر مااعرف احله :-
Chap12 home assignment




  • Use the same class of the last lab and add the following
member's functions:

  1. constructor with default parameters

  • Empty strings(" ") for StudentFName and StudentLName)
  • 0 for the StudentScore.
The constructor must output the following message:"Object has been created".

  1. Destructor function that output the following message:"Object has been deleted".
  2. A function to that increase the grade by an amount.
void increasegrade(float);







  • In the main function answer the following five questions to test the class StudentType.

  1. Write one statement to declare an array Name Studentlist with maximum size 50 of Type the class StudentType.
  2. Write the code to enter (from the user) data of 4 objects into array Studentlist
  3. Write the code to output only Students with score<50.
  4. Write the code to increase the score of all Students in Studentlist by 2 grades.
 
· Use the same class of the last lab and add the following
member's functions:​
1) constructor with default parameters
· Empty strings(" ") for ItemName and ItemType)
· 0 for the ItemPrice.
The constructor must output the following message:"Object has been created".
2) Destructor function that output the following message:"Object has been deleted".
3) IncreasePrice which adds an amount to the ItemPrice of the object.
​
· In the main function answer the following questions to test the class MenuType.
1) Write one statement to declare an array Name MenuList with maximum size 50 of Type the class MenuType.
2) Write the code to enter (from the user) data of 4 objects into array MenuList
3) Write the code to output only items offered in "Lunch" time.
4) Write the code to increase the price of all items in Menulist by 0.5 BD
 
بغيت الحل بليزززز
 
· Use the same class of the last lab and add the following

شنو الكلاس إلي سويتوه في اللاب ؟

اعتقد معلومات ناقصه .. محتاجين معلومات الكلاس اول
 
ممكن حل الاسايمنت ماعليكم امر مااعرف احله :-
Chap12 home assignment




  • Use the same class of the last lab and add the following
member's functions:

  1. constructor with default parameters

  • Empty strings(" ") for StudentFName and StudentLName)
  • 0 for the StudentScore.
The constructor must output the following message:"Object has been created".

  1. Destructor function that output the following message:"Object has been deleted".
  2. A function to that increase the grade by an amount.
void increasegrade(float);



عندج الحل تحت بس بدلي الأسامي!!

· Use the same class of the last lab and add the following
member's functions:​
1) constructor with default parameters
· Empty strings(" ") for ItemName and ItemType)
· 0 for the ItemPrice.
The constructor must output the following message:"Object has been created".
2) Destructor function that output the following message:"Object has been deleted".
3) IncreasePrice which adds an amount to the ItemPrice of the object.

PHP:
MenuType::MenuType()
{
    ItemName=" ";
    ItemType=" ";
    ItemPrice=0;

    cout<<endl;
}

Destructor function
MenueType::~MenuType()
{
    cout<<"Object has been deleted ";

    cout<<endl;

}

IncreasPrice by amount
void MenuType::IncreasPrice(float amount)
{
    ItemPrice=ItemPrice+amount;

    cout<<endl;
}

سويته بإعتبار اسم الكلاس MenuType

إذا اسم الكلاس غير .. بدليه

يبقى لج إلي في الـMain

إذا صار عندي وقت بسويه

ثنتيناتكم نفس الشي بس يفرق أسامي الشغلات
 
هذا حل الاسايمنت الا طاف والاسايمنت هذا يعتمد على اللي قبله
هل بحيث ان نزيد حل الاسايمنت هذا على الاسايمنت اللي قبل؟ ولا نبدل ولا شنو ؟



#include<iostream>
#include<string>
using namespace std;

class
studentType
{
private:
string FName
;
string LName
;
float testScore
;
public:
void SetData(string,string,float
);
void GetData(string&,string&,float
&);
bool Samescore(const studentType
&);
};

void studentType::SetData(string f ,string l ,float s
)
{
FName=f
;
LName=l
;
if(
0<=s && s<=100
)
testScore=s
;

}
void studentType::GetData(string &f ,string &l ,float &s
)
{
f=FName
;
l=LName
;
s=testScore
;
}

bool studentType::Samescore(const studentType &st
)
{
if(
testScore == st.testScore
)
return
true
;
else
return
false
;
}

int main
()
{

studentType S1,S2
;
string f,l
;
float s
;
bool R
;

cout<<"Enter first and last name , and testScore : "
;
cin>>f>>l>>s
;
S1.SetData(f,l,s
);
cout<<endl
;
cout<<"Enter first and last name , and testScore : "
;
cin>>f>>l>>s
;
S2.SetData(f,l,s
);
cout<<endl
;

R=S1.Samescore(S2
);
if(
R
)
cout<<"score of S1 = score of S2 "<<endl
;
else
cout<<"score of S1 not equal score of S2 "<<endl
;

cout<<endl
;

cout<<"All data of student (S1) : "<<endl
;
S1.GetData(f,l,s
);
cout<<"Name = "<<f<<" "<<l<<endl
;
cout<<"His/her test score = "<<s<<endl
;
cout<<endl
;

system("pause"
);
return
0
;


في احد يقدر يحل الاسايمنت قبل الساعه 11 ونص؟
جاني الم اسنان وماقدرت احله , فاذا احد بيتبرع يحله رحم الله والديكم
 
هذا حل الاسايمنت الا طاف والاسايمنت هذا يعتمد على اللي قبله
هل بحيث ان نزيد حل الاسايمنت هذا على الاسايمنت اللي قبل؟ ولا نبدل ولا شنو ؟



#include<iostream>
#include<string>
using namespace std;

class
studentType
{
private:
string FName
;
string LName
;
float testScore
;
public:
void SetData(string,string,float
);
void GetData(string&,string&,float
&);
bool Samescore(const studentType
&);
};

void studentType::SetData(string f ,string l ,float s
)
{
FName=f
;
LName=l
;
if(
0<=s && s<=100
)
testScore=s
;

}
void studentType::GetData(string &f ,string &l ,float &s
)
{
f=FName
;
l=LName
;
s=testScore
;
}

bool studentType::Samescore(const studentType &st
)
{
if(
testScore == st.testScore
)
return
true
;
else
return
false
;
}

int main
()
{

studentType S1,S2
;
string f,l
;
float s
;
bool R
;

cout<<"Enter first and last name , and testScore : "
;
cin>>f>>l>>s
;
S1.SetData(f,l,s
);
cout<<endl
;
cout<<"Enter first and last name , and testScore : "
;
cin>>f>>l>>s
;
S2.SetData(f,l,s
);
cout<<endl
;

R=S1.Samescore(S2
);
if(
R
)
cout<<"score of S1 = score of S2 "<<endl
;
else
cout<<"score of S1 not equal score of S2 "<<endl
;

cout<<endl
;

cout<<"All data of student (S1) : "<<endl
;
S1.GetData(f,l,s
);
cout<<"Name = "<<f<<" "<<l<<endl
;
cout<<"His/her test score = "<<s<<endl
;
cout<<endl
;

system("pause"
);
return
0
;


في احد يقدر يحل الاسايمنت قبل الساعه 11 ونص؟
جاني الم اسنان وماقدرت احله , فاذا احد بيتبرع يحله رحم الله والديكم

هذا جواب .. وين السؤال ؟!!
 
  • Use the same class of the last lab and add the following
member's functions:

  1. constructor with default parameters

  • Empty strings(" ") for StudentFName and StudentLName)
  • 0 for the StudentScore.
The constructor must output the following message:"Object has been created".

  1. Destructor function that output the following message:"Object has been deleted".
  2. A function to that increase the grade by an amount.
void increasegrade(float);







  • In the main function answer the following five questions to test the class StudentType.

  1. Write one statement to declare an array Name Studentlist with maximum size 50 of Type the class StudentType.
  2. Write the code to enter (from the user) data of 4 objects into array Studentlist
  3. Write the code to output only Students with score<50.
  4. Write the code to increase the score of all Students in Studentlist by 2 grades.
 
Lab Exercise
Struct (Records)

a. Write the definition of a structure type named studentthat includes the following members: student ID, name, and an array of size five to represent students’ quiz grades.

b. Write a function named getData that takes a parameter X of type student. The function should read the data of X.


c. Write a function named printData that takes a parameter X of type student. The function should display the data of X.

d. Write a function named calculateAvg that takes a parameter X of type student. The function should calculate and return the average of Xquiz grades.


e. Write a function named equal that takes two parameters X, and Y of type student. The function should return true if the Quiz array of X has the same content as the quiz grades of Y, otherwise the function should return false.

f. Write a main function to test your functions.
 
 
a. Write the definition of a structure type named section, which includesthe following components: section number (secNo) of type int, number of students in the section (noStudents) of type int, room number (roomNo) of type string, and an array (studentsList) of type student of size 20.

b. Write a function named getData that takes as parameter: mySection of typesection. The function should prompt the user to enter the data of mySection.

c. Write a function named printData that takes as parameter mySection of type section. The function should print the data of mySection.

d. Write a function named averageQuiz1 that takes as parameter mySectionof type section. The function should return the average of first quiz for all students in the section

e. Write a function named topStudents that take as parameter: mySection of type section. The function should print the students’ names with quiz1 score greater than the average of quiz1 for all students. (Hint: use averageQuiz1 function to get the average of quiz1)

f. Write a main program to test your functions.
 
ممكن شرح ال classes and Data Abstraction لانه باجر عندي اختبار :nosweat: ابي شرح استفيد منه للاختبار
 
اختي عاشقة الدموع

هذا حل العضو ITCS Student

PHP:
#include<iostream>
#include<string>
using namespace std;
class Email{
  private:
    string from;
    string to; 
    string body;
    int size;       
  
  public:
       Email( ); //default 
       ~Email();
    void setEmail(string, string, string, int);              
    void getEmail(string &, string &, string &, int &) ;
    void print( ) const;              
};

Email:: Email( ){
from=""; to=""; body=""; size=0;        
}

Email::~Email( ){
cout<<"Email Deleted";
}

void Email :: setEmail(string f, string t, string b, int  s)
{
  from = f;   to=t;   body=b;   size=s;   
}

void Email:: getEmail(string &f, string &t, string &b, int &s) 
{
  f=from;  t=to; b=body; s=size;   
} 

void Email::print( ) const{
     
     cout<<"From="<<from<<endl;
     cout<<"To="<<to<<endl;
     cout<<"Body="<<body<<endl;
     cout<<"Size in bytes="<<size<<endl;
} 

int largestEmail(Email list[ ], int length)
{
string Fromi, Toi, Bodyi, FromL, ToL, BodyL;
int Sizei, SizeL;
int largeIndex=0; //assume the first email at index zero has the largest size
for(int i=1; i<length; i++)
    {
       list[i].getEmail(Fromi, Toi, Bodyi, Sizei);
       list[largeIndex].getEmail(FromL, ToL, BodyL, SizeL);  
       if(Sizei >  SizeL)
           largeIndex=i;
    }   
return largeIndex;    
}



int main()
{
Email list[3]; 

list[0].setEmail("[email protected]", "[email protected]","Hello111",34);
list[0].setEmail("[email protected]", "[email protected]","Hello22",3);
list[0].setEmail("[email protected]", "[email protected]","Hello33",30);

cout<<"Largest Email at index = "<<largestEmail(list, 3);
    
system("pause");
return 0;
}
 
رقم 4 و 5 شلون أكتبهم ؟؟
PHP:
//write the defnetion of a structer type named movie to represnt a movie in video shop .

//the structers has the following members :

//Title (string) , Numberofcopies(int) , movietype(string)


//1- write one statment to declare FamilyMovie as a stuctere of type movie .

//2- write one statment to declare an array ListMovies of type movie of size 10.

//3- write statments to read data of 10 movies and store them in ListMovie .

//4- write staments to print data for all "comedy" movies in ListMovie .

//5- write statments to search and print titles of all movies with 0 numberofcopies in ListMovie.



struct
 movie

{

	string title;

	
int numberofcopies;

	string movietype;

}

movie FamilyMovie;

movie ListMovies[10];

for
(int i=0 ; i<10 ; i++)

cin >> ListMovies[i].title >>
" ">> ListMovies[i].numberofcopies >>" ">> ListMovies[i].movietype;

for
(int i=0

 
اختي عاشقة الدموع

هذا حل العضو ITCS Student

PHP:
#include<iostream>
#include<string>
using namespace std;
class Email{
  private:
    string from;
    string to; 
    string body;
    int size;       
  
  public:
       Email( ); //default 
       ~Email();
    void setEmail(string, string, string, int);              
    void getEmail(string &, string &, string &, int &) ;
    void print( ) const;              
};

Email:: Email( ){
from=""; to=""; body=""; size=0;        
}

Email::~Email( ){
cout<<"Email Deleted";
}

void Email :: setEmail(string f, string t, string b, int  s)
{
  from = f;   to=t;   body=b;   size=s;   
}

void Email:: getEmail(string &f, string &t, string &b, int &s) 
{
  f=from;  t=to; b=body; s=size;   
} 

void Email::print( ) const{
     
     cout<<"From="<<from<<endl;
     cout<<"To="<<to<<endl;
     cout<<"Body="<<body<<endl;
     cout<<"Size in bytes="<<size<<endl;
} 

int largestEmail(Email list[ ], int length)
{
string Fromi, Toi, Bodyi, FromL, ToL, BodyL;
int Sizei, SizeL;
int largeIndex=0; //assume the first email at index zero has the largest size
for(int i=1; i<length; i++)
    {
       list[i].getEmail(Fromi, Toi, Bodyi, Sizei);
       list[largeIndex].getEmail(FromL, ToL, BodyL, SizeL);  
       if(Sizei >  SizeL)
           largeIndex=i;
    }   
return largeIndex;    
}



int main()
{
Email list[3]; 

list[0].setEmail("[email protected]", "[email protected]","Hello111",34);
list[0].setEmail("[email protected]", "[email protected]","Hello22",3);
list[0].setEmail("[email protected]", "[email protected]","Hello33",30);

cout<<"Largest Email at index = "<<largestEmail(list, 3);
    
system("pause");
return 0;
}

تعديل بسيط في int main
list 0
list 1
list 2

للامانه ما اذكر هذا كان حلي
احتمال يكون حل احد الدكاتره وعلى الاغلب دكتورة امل غانم
 
حلي لسؤال الأول من توتريالز الكلاس للدكتوره نهله

Problem 1:
Write a C++ class including the code of the functions to maintain information about a Date. The
class Date data members are day, month, and year. The default values for the day and month is 1, and
for the year is 1900. In addition, the day must be within 1-31, a month must be within 1-12, and a
year within 1900-2100. The class Date function members include the following:
- A set function for all data members.
- A get function for data member.
- A print function to print the data in dd/mm/yyyy format.
- A constructor function with default valued parameter to initialize all data members.
- A destructor function to print the message “Date Object Terminated”


PHP:
#include <iostream>
#include <string>
using namespace std;

class Date
{
private:
    int day;
    int month;
    int year;

public:
    void Setallmembers(int ,int , int);
    void Getallmembers(int& ,int& , int& );
    void PrintC();
    Date( );
    ~Date( );
};

void Date::Setallmembers(int d,int m,int y)
{
    day=d;
    month=m;
    year=y;
}

void Date::Getallmembers(int& d,int& m,int& y)
{
    d=day;
    m=month;
    y=year;
}

void Date::PrintC(){;
{
    cout<<day<<"/"<<month<<"/"<<year;
    cout<<endl;
}
}

Date::Date()
{
    day=1;
    month=1;
    year=1900;
}

Date::~Date()
{
    cout<<endl;
    cout<<"The Object Termenited";
    cout<<endl;
}

int main()
{
    Date H;
    int d;
    int m;
    int y;

    H.PrintC();
    cout<<endl;

{
        {
        cout<<"Please Insert Day: ";
        cin>>d;
        while(d<1 || d>31)
        {
        cout<<"Error with day!!"<<endl;
        cout<<"Please insert Day again: ";
        cin>>d;
        }

        }
        
        {
        cout<<"Please Insert Month: ";
        cin>>m;
        while(m<1 || m>12)
        {
        cout<<"Error With Month!!"<<endl;
        cout<<"Please Insert Month Again: ";
        cin>>m;
        }

        }
        
        {
        cout<<"Please Insert Year: ";
        cin>>y;
        while(y<1900 || m>2100)
        {
        cout<<"Error With Month!!"<<endl;
        cout<<"Please Insert Year Again: ";
        cin>>y;
        }
        }
        H.Setallmembers(d,m,y);
}
cout<<endl;

H.PrintC();

    system("pause");
    return 0;
}


نسألكم الدعاء
 
إذا فيه خطأ .. خبروني عليه
 
عودة
أعلى أسفل