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

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

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

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

اختي تقصدين هذا السؤال ؟؟؟


1. Write a definition of a class Named MenuType for a restaurant. The class includes:
* As private member's data:
1. ItemName(string)// Name of the Item
2. ItemPrice(float)//Price of the Item
3. ItemType(string) // offered for("Breakfast", "Lunch" or "Dinner")
* As public member's functions:
1) SetItem which set data for all data members of the object(ItemName, ItemPrice and ItemType).
2) GetItem which will return all data members of the object(ItemName, ItemPrice and ItemType).
3) IncreasePrice which adds an amount to the ItemPrice of the object.
4) showMenu that output data members of the object(ItemName, ItemPrice and ItemType) in one line.

2. Write the code to implementation the above member functions of the class MenuType.
3. Write a main function to test the class MenuType.
1) Define an object plate1 of Type class MenuType.
2) Set the object plate1 with the values: "Plan Egg" 5.2 "Breakfast"
3) Write one statement to increase the price of plate1 by 1.2BD
4) Write one statement to output the plate1.


-----------------

اذا هذا هو النهاية الي يطلع لش فيه ايرور ما يحتاج تسوينه و في فنكشن زيادة بعد مسويتنها انتين
 
السلام عليكم يا حلوين بس عندي سؤال بسيط ضايعة فيه


و هذا البرنامج اللي سويته لســؤال الدكتورة قالت لنه Home assignment بس مو راضي يطلع لي السؤال في الموقع فمــراح اقدر احط السؤال بــس عندي استفسار بسيط في جزئية معينة شارحه لكم شنو يبون في الكوود ... انا سويت البرنامج كامل بس يطلع لي Error مو عارفة وين المشكلة



تفضلووو الكووود



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

class MenuType {

private:
	string ItemName;
	float ItemPrice;
	string ItemType;

public:
	void SetItem (string , float , string );
	void GetItem (string & , float & , string & );
	void IncreasePrice (float);
	void showMenu ();
	MenuType (string=" " , float=0 , string=" " );
	bool SameValue (MenuType other);
	~MenuType ();


};

void MenuType :: SetItem ( string X, float Y, string Z) {
	ItemName=X;
	ItemPrice=Y;
	ItemType=Z;
}


void MenuType :: GetItem (string & X, float & Y, string & Z){
	X=ItemName;
	Y=ItemPrice;
	Z=ItemType;
}

void MenuType :: IncreasePrice (float y){

	ItemPrice+= y;
}

void MenuType :: showMenu (){
	cout<<ItemName<< " " <<ItemPrice<< " " <<ItemType<<endl;
}

MenuType :: MenuType (string A , float B , string C ){
	SetItem(A,B,C);
}

bool MenuType :: SameValue (MenuType other){
	if(ItemPrice==other.ItemPrice)
		return true;
	else 
		return false;
		
}
	
MenuType :: ~MenuType  (){
	cout<<"Object has been deleted";
}

int main (){
	MenuType MenuList[50];
    string x;
	float y;
	string z;
	int i;

	cout<<" Pleas Enter 4 objects";
	for(i=0;i<4;i++)
	{
	cin>>x>>y>>z;
	MenuList[i].SetItem (x,y,z);
	}
	
	for (i=0;i<4;i++){

	 MenuList[i].GetItem (x,y,z);
	 if (z=="lunch")
	 MenuList[i].showMenu ();

	}

//اهني السؤال يبون نسوي مقارنة بين آيتم برايس مع آيتم برايس ثانية في الاري 
//و اذا يساوون بعض نطبع مسج انه اهمه متساوين و اذا مو متساوين نطبع مو متساوين

	MenuList[0].SameValue.MenuList[1]

			cout<<" they are equal ";
		else
			cout<<" they are not equal"
		

	for(int i=0;i<=50;i++){
		MenuList[i].showMenu();
		
	}
}

اتمنى تساعدووني :tears:​


هلا اختي ..

هذا البرنامج جيكته وشلت الايرورز ..

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

class MenuType { 

private: 
    string ItemName; 
    float ItemPrice; 
    string ItemType; 

public: 
    void SetItem (string , float , string ); 
    void GetItem (string & , float & , string & ); 
    void IncreasePrice (float); 
    void showMenu (); 
    MenuType (string=" " , float=0 , string=" " ); 
    bool SameValue (MenuType other); 
    ~MenuType (); 


}; 

void MenuType :: SetItem ( string X, float Y, string Z) { 
    ItemName=X; 
    ItemPrice=Y; 
    ItemType=Z; 
} 


void MenuType :: GetItem (string & X, float & Y, string & Z){ 
    X=ItemName; 
    Y=ItemPrice; 
    Z=ItemType; 
} 

void MenuType :: IncreasePrice (float y){ 

    ItemPrice+= y; 
} 

void MenuType :: showMenu (){ 
    cout<<ItemName<< " " <<ItemPrice<< " " <<ItemType<<endl; 
} 

MenuType :: MenuType (string A , float B , string C ){ 
    SetItem(A,B,C); 
} 

bool MenuType :: SameValue (MenuType other){ 
    if(ItemPrice==other.ItemPrice) 
        return true; 
    else  
        return false; 
         
} 
     
MenuType :: ~MenuType  (){ 
    cout<<"Object has been deleted"; 
} 

int main (){ 
    MenuType MenuList[50]; 
    string x; 
    float y; 
    string z; 
    int i; 

    cout<<" Pleas Enter 4 objects"; 
    for(i=0;i<4;i++) 
    { 
    cin>>x>>y>>z; 
    MenuList[i].SetItem (x,y,z); 
    } 
     
    for (i=0;i<4;i++){ 

     MenuList[i].GetItem (x,y,z); 
     if (z=="lunch") 
     MenuList[i].showMenu (); 

    } 

//اهني السؤال يبون نسوي مقارنة بين آيتم برايس مع آيتم برايس ثانية في الاري  
//و اذا يساوون بعض نطبع مسج انه اهمه متساوين و اذا مو متساوين نطبع مو متساوين 

	MenuList[0].SameValue(MenuList[1]); 

            cout<<" they are equal "; 
      
            cout<<" they are not equal"; 
         

    for(int i=0;i<=50;i++){ 
        MenuList[i].showMenu(); 
         
    } 
}

الايرور كانو اول شي اهني

PHP:
MenuList[0].SameValue.MenuList[1];

من بدل النقطه شلتها حطيت القوس ..

PHP:


PHP:
cout<<" they are equal "; 
      else
            cout<<" they are not equal";

اهني شلت الالس لان اصلا ماكو اف ستيتمنت فما يصير تحطين الالس بدونها..

وفيه مكان كنتين ناسيه ; ... وبس ..

بس اني شاكه في الاوتبوت يمكن سويت شي غلط او شي ..

جيكي الاوتبوت
 
في شي عطيتكم اياه ابيكم تعدلونه :


في الget function لكل واحد من الdata members

المفروض تكون بدون parameters

لأن الي داخل اصلا ما بنستخدمهم لأن احنا بنسوي return للأصلي الموجود في الكلاس

فما يحتاج نسوي نسخة و نحطها في الباراميتر ...

يعني بصيرون جذي

كود:
long getAccount ();

string getName();

float getBalance ();

:RpS_laugh: آسفة بس توني منتبهة ان المفروض ما يكون في باراميترز

حتى اذا بتكتبها برى الكلاس نفس الشي بالضبط بس شيلو الباراميترز
 
من الى كتبته انه ؟
والى الموضوع القبلي ... راوينا في وين لانه مادليت في الورقه
 
في الي انتا كاتبنه ... في اول صفحة في الكلاس ...

شيل الباراميترز من الgetBalance , getname,getAccount

و الي في الدرس الي قبل احنا كتبنا داخل كلاس و كتبنا برى الكلاس
 
اوكي
في Public بس انحط كول حق الفنكشن الى امسوينهم صح ؟
 
اوكي
في Public بس انحط كول حق الفنكشن الى امسوينهم صح ؟

هو مو كول ... يسمونه prototype

يعني ان نكتب بس الهدر مال الفنكشن

:RpS_wink: الكول بشرحه الاثنين لأن ما كملناه
 
اختي تقصدين هذا السؤال ؟؟؟


1. Write a definition of a class Named MenuType for a restaurant. The class includes:
* As private member's data:
1. ItemName(string)// Name of the Item
2. ItemPrice(float)//Price of the Item
3. ItemType(string) // offered for("Breakfast", "Lunch" or "Dinner")
* As public member's functions:
1) SetItem which set data for all data members of the object(ItemName, ItemPrice and ItemType).
2) GetItem which will return all data members of the object(ItemName, ItemPrice and ItemType).
3) IncreasePrice which adds an amount to the ItemPrice of the object.
4) showMenu that output data members of the object(ItemName, ItemPrice and ItemType) in one line.

2. Write the code to implementation the above member functions of the class MenuType.
3. Write a main function to test the class MenuType.
1) Define an object plate1 of Type class MenuType.
2) Set the object plate1 with the values: "Plan Egg" 5.2 "Breakfast"
3) Write one statement to increase the price of plate1 by 1.2BD
4) Write one statement to output the plate1.


-----------------

اذا هذا هو النهاية الي يطلع لش فيه ايرور ما يحتاج تسوينه و في فنكشن زيادة بعد مسويتنها انتين






اي اعتقد انه نفس السؤال بس في جزء ثاني من السؤال عطتنه اياه الدكتورة بس الله يهداها مو حاطته في الموقع مادري شلون جذي :RpS_glare:
 
هلا اختي ..

هذا البرنامج جيكته وشلت الايرورز ..

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

class MenuType { 

private: 
    string ItemName; 
    float ItemPrice; 
    string ItemType; 

public: 
    void SetItem (string , float , string ); 
    void GetItem (string & , float & , string & ); 
    void IncreasePrice (float); 
    void showMenu (); 
    MenuType (string=" " , float=0 , string=" " ); 
    bool SameValue (MenuType other); 
    ~MenuType (); 


}; 

void MenuType :: SetItem ( string X, float Y, string Z) { 
    ItemName=X; 
    ItemPrice=Y; 
    ItemType=Z; 
} 


void MenuType :: GetItem (string & X, float & Y, string & Z){ 
    X=ItemName; 
    Y=ItemPrice; 
    Z=ItemType; 
} 

void MenuType :: IncreasePrice (float y){ 

    ItemPrice+= y; 
} 

void MenuType :: showMenu (){ 
    cout<<ItemName<< " " <<ItemPrice<< " " <<ItemType<<endl; 
} 

MenuType :: MenuType (string A , float B , string C ){ 
    SetItem(A,B,C); 
} 

bool MenuType :: SameValue (MenuType other){ 
    if(ItemPrice==other.ItemPrice) 
        return true; 
    else  
        return false; 
         
} 
     
MenuType :: ~MenuType  (){ 
    cout<<"Object has been deleted"; 
} 

int main (){ 
    MenuType MenuList[50]; 
    string x; 
    float y; 
    string z; 
    int i; 

    cout<<" Pleas Enter 4 objects"; 
    for(i=0;i<4;i++) 
    { 
    cin>>x>>y>>z; 
    MenuList[i].SetItem (x,y,z); 
    } 
     
    for (i=0;i<4;i++){ 

     MenuList[i].GetItem (x,y,z); 
     if (z=="lunch") 
     MenuList[i].showMenu (); 

    } 

//اهني السؤال يبون نسوي مقارنة بين آيتم برايس مع آيتم برايس ثانية في الاري  
//و اذا يساوون بعض نطبع مسج انه اهمه متساوين و اذا مو متساوين نطبع مو متساوين 

	MenuList[0].SameValue(MenuList[1]); 

            cout<<" they are equal "; 
      
            cout<<" they are not equal"; 
         

    for(int i=0;i<=50;i++){ 
        MenuList[i].showMenu(); 
         
    } 
}

الايرور كانو اول شي اهني

PHP:
MenuList[0].SameValue.MenuList[1];

من بدل النقطه شلتها حطيت القوس ..

PHP:


PHP:
cout<<" they are equal "; 
      else
            cout<<" they are not equal";

اهني شلت الالس لان اصلا ماكو اف ستيتمنت فما يصير تحطين الالس بدونها..

وفيه مكان كنتين ناسيه ; ... وبس ..

بس اني شاكه في الاوتبوت يمكن سويت شي غلط او شي ..

جيكي الاوتبوت




يا بعد قلبي مشكووورة خيتي تسلمين ما قصرتي
انا ما عندي البرنامج على لاب توبي باجيك الاوتبوت اذا داومت

:RpS_wink:


مشكوورة وايد نخدمج في عرسج انشاء الله :smile:
 
بكون في محاضرة يوم الاثنين 1/11 الساعة 11 في S40-2088
 
هالسؤال قعدت افكر فيه... اهم يبونه نجمع كل رقمين في الاراي ونحط المجموع مالهم في الخانه الثالثه ؟ يعني نسوي خانه بعد كل رقمين في الاراي
وله شي غير.... المهم انه النت بطيى كلش مايفتح حتى قوقل ههههه مادري شفيه يمكن الى عنده السؤال من الميدتيرم مال سنه 2009 بحاول اصوره بعدين وادا عنده احد السؤال اقولي يبينا نستعمل شنو binary search مثلا

هذا السؤال كتبته بس ناقص االجداول

PHP:
write a function named insertSum that takes as parameters : an array of integers , number of elements in the array which is passed by reference , and a constant array size.the function should insert the sum of two consecutive elements in the array if the sum is less than the value of the element after the consecutive elements after the consecutive elements there is a place in the array to insert new element.

void insertSum(int arr[],int &length,cont int SIZE);
 
السؤال سهل

تسوي فور لوب يمر على الأري كامل

بتجمع الأول و الثاني الي هو:-

كود:
 arr[i]=arr[i+1]

و تسيف قيمته في فاريبل

كود:
 sum=arr[i]=arr[i+1]

بعدين تجيك الجمع اذا كان اصغر من الرقم الي في الخانة الثالثة سو شفت + اضافة اذا كان اكبر لا ما يسوي شي

و كل هذا داخل الفور لوب بكون

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

اذا كان اصغر منه اوكي سو اضافة ( الي كان في فنكشن الانسيرت تحطه في الelse ) الي هي اذا كان المجموع اقل او يساوي من الرقم الي بعده
 
الي عطتهم الدكتورة امتحانات غير عن الي موجودين في المكتبة اتمنى يسويهم ليي سكان و يطرشهم اليوم
 
انه عندي امتحانين مال الفصل الاول والثاني...الدكتوره عطتنا اياهم
بسويهم سكان وبحاول ارفعهم لانه النت وايد بطيى
 
اي اوكي عشان اليوم ابي اطبعهم و اصورهم ليكم
 
سويتهم اسكان
اول ماخلص من رفعهم بحطهم
 
متى المدتيرم؟؟؟
وفي اي جباارتر ؟!!

^^
 
عودة
أعلى أسفل