المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : مينpublic ومين private في الكلاس؟



رحاب
15-12-2005, 07:19 PM
Airline Reservation System:


A small airline has just purchased a computer for its new automated reservation system. You have been asked to program the new system. You are to write a class-based C++ program (create a suitable class using the C++ keyword class with public and private sections and use it through the function main) to assign seats on each flight of the airline's only plane (capacity: 100 seats).


Your program should display the following menu of alternatives-Please type 1 for "First Class" and Please type 2 for "Economy Class". If the person types 1, your program should assign a seat in the first class section (seats: 1-25). If the person types 2, your program should assign a seat in the economy section (seats: 26-100). Your program should print a boarding pass indicating the person's seat number and whether it is in the first class or economy class of the plane.


Your program should, of course, never assign a seat that has already been assigned. When the first class section is full, your program should ask the person if it is acceptable to be placed in the economy section (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message "Next flight leaves in 3 hours". If the plane is full, then print an appropriate message









دا البروجكت المطلوب مني عمله

يعني مشيت بالشغل بس بالأراي

الان طبعا هو طالبه كلاس

فسؤالي أدري بتلطشوني عليه

بس وش اسوي:$ كل الكلاسبيعطونا هو دائما جاهز ماغير احنا نقعد نعمل الفانكشون تبعه



مين أحط public ومين ؟private



يعني جى على بالي المقاعد تكون برايفت هي ودرجة الرحلة؟

صح الكلام ولا مو؟؟

اتمنى أدخل الليل والقى الاجابة لأنه الله يسلمكم الأحد يبغاه الدكتور



ودمتم بلا برمجة توجع الراس:178:

إشراقة أمل
16-12-2005, 01:17 AM
تعاليلي علمسنجر

http://smilies.sofrayt.com/^/aiw/biggrin.gif

رحاب
16-12-2005, 01:21 AM
أنا عندك:206:
بس برضه اشرحي في الدرر خلي الناس الثانية تفهم وتشوف خبراتك الفذة:221:

بخيت
16-12-2005, 01:51 AM
كيف حالك يارحاب :)

طول الله عمرك وفرج الله همك ولمك باهلك واصحابك واحبابك

رحاب الـ private كلاس

غالباً هو لتحديد عدد المقاعد الفاضيه والمشغوله وما اذا كان الدرجه الاولى للرجله فاضيه او مليانه عشان اذا فاضيه يتم تحديد مقعد الراكب واذا مليانه ينتقل البرنامج للسؤال عن اذا مناسبه الدرجه السياحيه او لا ويحدد النتيجه
(هذا الجزء من البرنامج ليس للعميل علاقه فيه )

أما الـ public كلاس

فغالبا هو لاختيار المقعد وطباعة كرت الركوب او الاركاب على قولتهم :)
(هذا الجزء بما يحتويه من معلومات عن المقاعد المشغوله والفارغه هو اهتمام العميل )



ان شاء الله يكون كلامي مضبوط والله يستر :)

تحياتي

رحاب
16-12-2005, 01:57 AM
هلا والله هلا
قاعدة من اول انتظر ردك ماأبغى أنام إلا وأنا شايفة الرد
يعني نقول كده
class arport

{

puplic:

بلاوي زرقة:129: (برنت وتحديد الدرجة وسيت وجيت واللي منه)

privat:

set

ودرجة الحجز مرة سياحي ومرة درجةاولى{

صح الكلام كده؟

أشكرك جدا جدا اخيعلى مساعدتك
جلوسي في المتواجدين ماراح هباء:206: وشكرا لدعائك الطيب:)
دمت بخير

shadow hearts
16-12-2005, 04:36 AM
السلام عليكم ورحمة الله وبركاته ...

اهلين رحاب ...

ياستي البخيت رد رد كافي ...

واسف جدا اني اتاخرت ...

وبعدين الماده ايش هي "oop"

او data structuer

للعلم فقط "عشان لو عندي شي يفيدكم اضيفه ...

أرق الاماني بكل جميل

رحاب
16-12-2005, 12:48 PM
هلا والله بشادو
وينك ياولدي من زمااااان عنك؟!
المادة سي بلسين بعيد عنك بس هذا آخر كورس آخذه فيها ربنا يخلصني منها:(
عندك فكرة في البرنامج؟

shadow hearts
17-12-2005, 09:48 AM
السلام عليكم ورحمة الله وبراته

ياستي انا موجود بس معسكر في درر التكنلوجيا

مطلع لا اكتر ...

برتب افكاري عن دا البرنامج وبنزله في دا الموضوع

ان شاء الله

أرق الاماني بكل جميل

رحاب
17-12-2005, 10:10 AM
صباح النور
هلا أخوي
حليت البرنامج خليت الكراسي بس برايفت بقية الشغلات ببلك وعملت فنكشن خاص بــ كل وحدة باقي المين
أنزل البرنامج تشيكوا عليه؟!........ولا أخلي الطابق مستور(وجه مستحي حيييل):$
على فكرة بكرة لازم يتسلم لدكتوري الله يسامحه بس:178:
دمتم بخير

shadow hearts
17-12-2005, 03:30 PM
الله يسامحك يارحاب

وانا جهزة الفكره ...ليا نص ساعه برتب ...

المهم ارفعي البرنامج هنا ...

للاستفاده ... ومنك نستفيد

أرق الاماني بكل جميل

رحاب
17-12-2005, 06:34 PM
هلا أخوي
بس أعطيني نص ساعة أرتب بعض الامور في البرنامج واعرضه عليكم
دوبي جاية من الجامعة:(
وشكرا لإهتمامك ياطيب

رحاب
17-12-2005, 07:12 PM
#include<iostream.h>
class airline
{
public:
airline();
int setseat();
int FirstClass(int[],int&);
void EconomyClass(int[],int &);
void somk();
private:
int seat;
};

int airline::FirstClass (int seat1[],int &l)
{
int j=0;
if (j!=24)
for (j=0; j<25; j++)
{
seat=seat1[j];
seat1[j]++;
cout <<"\n\n\tYour seeat in First Class part";
cout <<"\n\n\tTheNumber Of Your Seeat Is = "<<j+1;
}
else
{
cout <<"\n\nThere is no place we are sorry about that";
cout <<"\n\nNext Flight Leave In 3 Hours ";
cout << "\n\nYou can stay in Economy part if you need that try agin and choose 2"<<"\n\n\n\n\n";
}
return --l;
}
void airline::EconomyClass (int seat2[],int &l)
{
int j=0;
if (j!=99)
for (j=26; j<100; j++)
{
seat=seat2[j];
seat2[j]++;
cout <<"\n\n\tYour seeat in First Class part";
cout <<"\n\n\tTheNumber Of Your Seeat Is = "<<j+1;
}
else
{
cout <<"\n\nThere is no place we are sorry about that";
cout <<"\n\nNext Flight Leave In 3 Hours ";
cout << "\n\nYou can stay in Economy part if you need that try agin and choose 2"<<"\n\n\n\n\n";
}
}
void airline::somk()
{
char y;

if (y=='Y'||y=='y')
{
cout <<"\n\n\tYou seeat in *Nonsmoking* part ";
if (y=='N'||y=='n')
cout <<"\n\n\tYou seeat in *smoking* part ";
cout <<"\n\n\n\tThanks For Use My System .. \n\n\n\n\n\n\n\n\n" ;
}
int main()
{
airline b;
int s;
char y;
const int size=10;
int a[size];
for (int i=0; i<size; i++)
a[i]=0;
for (int l=0; l<size; l++)
{
cout << " \t\t\tHi\n\n\t\tThinks for use my system\n";
cout << "\nIf you need stay in 'first Class' please choose 1: ";
cout << "\nIf you need stay in 'Economy' please choose 2:\n ";
cin >> s;
if (s==1)
b.FirstClass(a,l);
if (s==2)
b.EconomyClass(a,l);
if (s!=1&&s!=2)
cout << "\n\nPlease Try Again And Choose Right Number "<<"\n\n\n\n\n";

}
cout <<"\n\nDo You Need Set In Nonsmoking"<<"Y = Yes && N = No : ";
cin >>y;
b.somk();
return 0;
}

دا الكود

عندي احساس الدكتور بعد برنامجي راح يقدم أستقالته بجدارة :206:

shadow hearts
17-12-2005, 11:22 PM
رحاب

ليش ماسجلتي البيانات تتسجل في file بدل array

عن طريق الfstream

دي ملاحظتي الوحيده

بالتوفيق ان شاء الله

أرق الاماني بكل جميل

رحاب
18-12-2005, 12:10 AM
هلا شادو
مأخذنا الشئ دا !!
شكله تابع للداتا ؟
الخطأ الليبيطلع بس:على فكرة السايز 100 مو10 عدلته الآن وبرضه نفسالخطأ
:\Documents and Settings\Rehab\My Documents\projectt.cpp(61) : error C2601: 'main' : local function definitions are illegal
C:\Documents and Settings\Rehab\My Documents\projectt.cpp(89) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

projectt.obj - 2 error(s), 0 warning(s)