الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ممكن تشرحون لي هذا البرنامج للضروره

بدأه عذوق في 23 مارس 2009 · 8 رد · 2,430 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكــم ورحمـة الله وبركاتــه ،،

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

بالتفصيل جدا جدا

وماهو المطلوب

ربي يوفقكم

The system should keep information about Passengers and Reservations they have made through the system. For a passenger, his name, phone, and passport number must be stored. The system must allow the update of this information. For each reservation, its ID (reservation number) which is automatically generated by the system, the passenger information, and the seat type (smoker or not) should be stored.

The id a Reservation is a single string composed of two parts: two characters which are the first two letters of the passengers name, followed by a serial number generated by the system.

Task A

Write a Passenger class which holds information about passenger including their name (string), passport number (string containing letters and numbers), and contact number (long). The class should contain both default and parameterized constructor, set/get methods for each attribute, and method to print the details of the Passenger.

Task B

Create a header file for the class student which contains the following header, then write its implementation file.

#ifndef RESERVATION_H_

#define RESERVATION_H_



#include <iostream>

#include <string>

#include "Passenger.h"

using namespace std;





class Reservation{



private:

	  static int sn;

	  const string ID; //first two letters of passanger name plus sn

	  bool smokerSeat;

	  Passenger passenger;



public:



	  //Constructor taking the parameters of Passenger

	  Reservation(string psngrName, long psngrPhone, string psngrPassport, bool	 smoke);



	  //Constructor taking a Passenger object

	  Reservation(Passenger& psngr, bool smoke);



	  Passenger getPassenger();		   bool isSmoker();



	  string getReservationNumber()	   void printDetails();

};





#endif /*RESERVATION_H_*/

_________

تم تعديل هذه المشاركة بواسطة عذوق في 23 مارس 2009 في 12:10

#2

اخي /اختي ..

نرجوا منك مراجعة ضوابط الكتابة بالمنتدى وخصوصا هذه الفقرة .

اقتباس
2. يتم طرح السؤال باللغة العربية الفصحي لأنها مفهومة لكل العرب ، وتجنب الكلمات ذات المرجع المحلي و الا تعرضت المشاركة للحذف

*************************

الي فهمته من المشاركة هو : مطلوب عمل كلاس للمسافرين والحجوزات على ان يحتوي كلاس المسافر : his name, phone, and passport number وعلى ان يتم تحديث المعلومات من قبل النظام .

ولكل حجز : its ID والذي يتم توليده اوتوماتيكيا , و passenger information ونوع المقعد ( smoker or not ) .

قم بعرض محاولاتك وان شاء الله الكل يساعدك .

تحياتي ...

llback.jpg

اشهد ان لا إله إلا الله وان محمدا ً رسول الله

#3

السلام عليكــم ورحمـة الله وبركاتــه ،،

اتمنى مراجعه

ضوابط الكتابه

شاهد رابطين في توقيعي

لعلها تفيدك في هذا الشأن

لكم مني خالص التقدير

*********************

دروس الاكسس

قاعدة بيانات بالسي++

قاعدة بيانات اخرى بالسي++

الفريق العربي للبرمجه

*********************

كان الله في عون العبد مادام العبد في عون اخيه

#4

شكرا لكم

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

مااقدر اضع محاولاتي هنا لان السؤال مطلوب في الدراسه وربما عند وضع محاولاتي تأخذها بعض الطالبات ممن يتصفحن الموقع

هل فيه أحد يقدر يشرح لي كل تاسك واضع محاولاتي له ؟ عن طريق الرسائل الخاصه ؟

#5

بســم الله الـرحمــن الرحيــم

السلام عليكــم ورحمـة الله وبركاتــه ،،

اولا اختي الكريمة لدي ملاحظة صغيرة ارجو ان تتقبليها بصدر رحب

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

~~~

السؤال - كتابة كلاس لتخزين معلومات حجز المسافرين هذه المعلومات هي ID من النوع string بحيث يكون الحرفين الاولين منه هي احرف اسم المسافر متبوعة برقم متسلسل يتم توليده ذاتيا من البرنامج , بالاضافة لمعلومات المسافر وهي الاتي

name (string) الاسم من نوع سلسلة حرفية

passport number (string containing letters and numbers) رقم جواز السفر من سلسلة حرفية تحوي ارقام و حروف

contact number (long).رقم الاتصال " الهاتف " من النوع الرقمي الطويل

ايظا نوع المقعد مدخن ام غير مدخن

المطلوب ايظا كتابة دوال اسند و احظار قيم المتغيرات السابقة كذلك Constructor " منشيء" افتراضي للكلاس و اخر يمكن اسناد القيم له مباشرة

ايظا يجب التصريح عن الكلاس ودواله في ملف رائسي باسم Passenger واعتقد انه يوجد خطا غير مقصود في نص السؤال حيث مكتوب Student بدل Passenger , ثم تطبيق دوال الملف الرائسي في ملف .cpp

تحياتي

تم تعديل هذه المشاركة بواسطة HaTy في 29 مارس 2009 في 18:10

while( "اسلام" )
{
 cout >> "الموت لبني صهيون" >> endl;
}
return "فلسطين";
#6

بســم الله الـرحمــن الرحيــم

السلام عليكــم ورحمـة الله وبركاتــه ،،

اولا الملف الرائسي Passenger.h كلاتي :

 //  Passenger.h

#ifndef PASSENGER_H
#define PASSENGER_H

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

class Passenger
{
public:
Passenger();
Passenger(string PsngrName , string PsngrPassportNo ,long PsngrTelNo , bool PsngrSmokingSeat);
~Passenger();

void SetPsgrName(string psgrName);
string GetPsgrName(void);

void SetPsgrID(void);
string GetPsgrID(void);

void SetPassportNo(string psgrPassportNo);
string GetPassportNo(void);

void SetPsgrTelNo(long psgrTelNo);
long GetPsgrTelNo(void);

void SetSmokingSeat(bool smoker);
bool GetSmokingSeat(void);

void ShowPsgrData(void);

private:
string PsgrID;
string PsgrName;
string PassportNo;
long TelNo; // " string TelNo; " is more convenient than " long TelNo;"
bool SmokingSeat;

};

#endif

ملف التطبيق Implementation وهو الملف Passenger.cpp كالاتي :

 // Passenger.cpp

#include "Passenger.h"
#include <cstdlib>

static unsigned int SerNO = 0;

Passenger::Passenger()
{
}

Passenger::Passenger(string PsngrName , string PsngrPassportNo , long PsngrTelNo , bool PsngrSmokingSeat)
{
PsgrName	= PsngrName;
PassportNo  = PsngrPassportNo;
TelNo	   = PsngrTelNo;
SmokingSeat = PsngrSmokingSeat;

SetPsgrID();
}

Passenger::~Passenger()
{
}

void Passenger::SetPsgrName(string psgrName)
{
PsgrName = psgrName;
//PsgrID[0]= psgrName[0]; modify ID after SetName()
//PsgrID[1]= psgrName[1]; modify ID after SetName()
}

string Passenger::GetPsgrName(void)
{
return PsgrName;
}

void Passenger::SetPsgrID(void)
{
char  tmpStr[16];
_itoa(SerNO, tmpStr,10);
PsgrID.append(PsgrName ,0,2 );
PsgrID.append(tmpStr);
SerNO++;
}

string Passenger::GetPsgrID(void)
{
return PsgrID;
}

void Passenger::SetPassportNo(string psgrPassportNo)
{
PassportNo  = psgrPassportNo; 
}

string Passenger::GetPassportNo(void)
{
return PassportNo;
}

void Passenger::SetPsgrTelNo( long psgrTelNo)
{
TelNo = psgrTelNo;
}

long Passenger::GetPsgrTelNo(void)
{
return TelNo;
}

void Passenger::SetSmokingSeat(bool smoker)
{
SmokingSeat = smoker;
}

bool Passenger::GetSmokingSeat(void)
{
return SmokingSeat;
}

void Passenger::ShowPsgrData(void)
{
cout << "Passenger Reservation ID : " << PsgrID.c_str()	 << endl;
cout << "Passenger Name		   : " << PsgrName.c_str()   << endl;
cout << "Passenger PassportNo	 : " << PassportNo.c_str() << endl;
cout << "Passenger Contact Info   : " << TelNo			  << endl;

if ( SmokingSeat ){
cout << "Passenger SmokingSeat	: Smoker\n";
}
else{
  cout << "Passenger SmokingSeat	: NonSmoker\n";
}

}

يمكن تطوير الكلاس بوضعه في قائمة متصلة Linked List

تحياتي

تم تعديل هذه المشاركة بواسطة HaTy في 30 مارس 2009 في 11:24

while( "اسلام" )
{
 cout >> "الموت لبني صهيون" >> endl;
}
return "فلسطين";
#7

Problem Description (2)

The Reservations are either OK Reservations or Waiting Reservations. For an OK Reservation, the reservation Date and whether the ticket is bought or not should be stored. For a waiting reservation, its order in the waiting list must be stored.

Task C

1. Write the OK Reservation class which is a derived class from Reservation. It should contain two attributes: reservation date and ticket bought, which is a Boolean, initially set to false. Don't forget the make the Reservation class an abstract class.

2. Write the Waiting Reservation class which is a derived class from Reservation. It should contain a single attribute: turn in list which specifies the order of the waiting reservations (i.e. is it the first reservation on the waiting list? The second? The third?... etc). It should also contain a method that moves reservation forward in list, which is used to move the waiting reservation higher in the waiting list, provided of course that it is not the first reservation.

Problem Description (3)

The Flight class is the class where actual reservation can be made. A flight has a limited number of seats and a maximum its waiting list.

When a seat is reserved for a passenger, and a vacant seat is available, a new OK reservation will be made for the passenger. If not, a new Waiting Reservation will be created if the waiting list has not reached the maximum length yet. Otherwise, no reservation will be made for the passenger.

When a reservation is cancelled, the reservation type is checked. If it is an OK Reservation and there are Waiting reservations on the list, then the OK reservation will be deleted and the first Waiting reservation on the waiting list will be removed from the list and converted to a new OK reservation for the same passenger. The rest of the waiting reservation on the waiting list will be moved forward on the list.

If the reservation to be deleted was a Waiting reservation, then the all the Waiting reservations that come after it on the list should be moved forward after deleting it.

In addition, it is possible to print the waiting list and the list of OK reservations for the flight.

Task D

Implement the Flight class below. You may add attributes or private functions as you need.

class Flight{

private:

int waitingListMax;

int seats;

Reservation** reservations;

public:

Flight(int capacity, int waitingMax);

bool reserveSeat(Passenger psngr, bool smoker);

//Searches for the reservation with the given reservation number, and //deletes it. Uses the confirmReservation function if the reservation to be //deleted was an OK one

void cancelReservation(string resNum);

//Deletes the given waiting reservation after creating a new OK reservation //for the same passenger. Returns a pointer to the newly created reservation

OKReservation* confirmReservation(WaitingReservation* res);

void printWaitingList();

void printReservationList();

};

Task E

Add a function called generate Manifest, which receives a file name, and creates a new file with the given name. In the file, the OK reservations are stored in their binary format. The order of which they are written must correspond to their position in the array.

............

هذي تكمله السؤال

اخي انا لم أقصد اني لا أريد ان يرى الطلبه محاولاتي والبرنامج ليس من تصميمي

هذا بروجكت من الاستاذه مطلوب نشتغل عليه ونسلمه لها

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

اي تشابه في الحل على طول صفر من غير نقاش :( حيث ان كثير من الطالبات الي معي في نفس الكورس يتابعن هذا الموقع لروعته في الشرح

اتمنى تكونون فهمت قصدي

كل مايهمني ان افهم على الاقل كل تاسك شنو المطلوب فيه وعن شنو يتكلم بالتفصيل :(

وجزاكم الله كل خير

ماقصرتوا

تم تعديل هذه المشاركة بواسطة عذوق في 30 مارس 2009 في 15:01

#8

بســم الله الـرحمــن الرحيــم

السلام عليكــم ورحمـة الله وبركاتــه ،،

اختي الكريمة حتى تفهمي هذا السؤال بشكل جيد , عليك بمراجعة بعض الدروس حول مفهوم الـ Class و مفهوم الوراثة في الاصناف حتى يمكنك اشتقاق اصناف جديدة من الكلاس الرئيس " Passenger " الموضوع ليس بتلك الصعوبة بل هو سهل تماما

ايظا استعيني ببعض برامج الترجمة او يمكنك استخدام موقع Google مثلا لترجمة نص السؤال حتى تفهمي ما هو المطلوب

فحتى لو وضعنا لك حل السؤال كاملا لن تستفيدي كثيرا ما لم تلمي بمفهوم الكلاس و الوراثة , راجعي بعض المواضيع بهذا الشأن وستجدين الكثير منها في هذا المنتدى , ثم ضعي محاولاتك وستجدين الجميع لن يتأخروا بمساعدتك

وفقك الله

تحياتي

while( "اسلام" )
{
 cout >> "الموت لبني صهيون" >> endl;
}
return "فلسطين";
#9

شكرا لكم جميعا

ماقصرتوا

وفقكم الله لما يحبه الله ويرضاه

مواضيع مشابهة