Skip to main content

Re: ::: vuaskari.com ::: Need cs-201 assignment

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

class Schedule
{
public:
enum Place
{
Lahore =0 ,
Karachi,
Islamabad,
Peshawar,
Quetta
};
private:
bool trip;
string departureDate;
string returnDate;
Place destination; //(Going to)
Place origin; //(Leaving from)
int flightNo;
int depatureTime; //only hour (not full time like 12:56)
int arrivalTime;

public:
Schedule() //default constructor
{
trip = false;
departureDate = "";
returnDate = "";
destination = Lahore;
origin = Lahore;
flightNo = 0;
depatureTime = 0;
arrivalTime = 0;
};

~Schedule() //destructor
{
cout<<"Destructor ..."<<endl;
};

//get/set properties
bool getTrip() {return trip;};
string getDepartureDate(){return departureDate;};
string getReturnDate(){return returnDate;};
Place getDestination(){return destination;};
Place getOrigin(){return origin;};
int getFlightNo(){return flightNo;};
int getDepatureTime(){return depatureTime;};
int getArrivalTime(){return arrivalTime;};

void setTrip(bool val) {trip = val;};
void setDepartureDate(string date){departureDate = date;};
void setReturnDate(string date){returnDate = date;};
void setDestination(Place val){destination = val;};
void setOrigin(Place val){origin = val;};
void setFlightNo(int val){flightNo = val;};
void setDepatureTime(int aTime){depatureTime = aTime;};
void setArrivalTime(int aTime){arrivalTime = aTime;};

// method for get input
void getInputData()
{
int i;

cout<<"\n======================================="<<endl;
cout<<"Enter flight information :"<<endl;
cout<<"Trip type (0: Oneway Trip | 1: Round Trip): ";
cin>>trip;

cout<<"Date of departure: ";
cin>>departureDate;


returnDate = "";
if(trip)//round trip
{
cout<<"Date of return: ";
cin>>returnDate;
}

do
{
cout<<"Destination (0: Lahore, 1: Karachi, 2: Islamabad, 3: Peshawar, 4: Quetta): ";
cin>>i;
}
while (i<0 || i >4);
destination = Place(i);
do
{
cout<<"Origin (0: Lahore, 1: Karachi, 2: Islamabad, 3: Peshawar, 4: Quetta): ";
cin>>i;
}
while (i<0 || i >4);
origin = Place(i);

/* initialize random seed: */
srand ( time(NULL) );
flightNo = rand() % 201;

depatureTime = rand() % 24;
arrivalTime = rand() % 24;
if(abs(arrivalTime-depatureTime)<2) arrivalTime = (arrivalTime + 2)%24;
};

// method for write to disk
void writeData()
{
static char *places[] = {
"Lahore", "Karachi", "Islamabad", "Peshawar", "Quetta"
};

ofstream myfile ("schedule.txt");
if (myfile.is_open())
{
myfile << "Flight No: "<<flightNo<<endl;
myfile << "Origin: "<<places[origin]<<endl;
myfile << "Destination: "<<places[destination]<<endl;
myfile << "Date of Departure: "<<departureDate<<endl;
if(trip)
{
myfile << "Date of Return: "<<returnDate<<endl;
}
else
{
myfile << "Date of Return: N/A"<<endl;
}
myfile << "Departure Time: "<<depatureTime<<":00"<<endl;
myfile << "Arrival Time: "<<arrivalTime<<":00"<<endl;
myfile.close();
}
else cout << "Unable to open file";
};
};

int main()
{
Schedule *mysdl = new Schedule();
mysdl->getInputData();
mysdl->writeData();

system("pause");
return 0;
}
ENJOY STUDENTS!!............

On Sun, Jan 15, 2012 at 9:25 AM, mehnaz aslam <mehnazaslam306@gmail.com> wrote:
AOA

please cs-201 ki assignment share karen.

mehnazaslam

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS
Group:   http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group:         http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group:    http://groups.google.com/group/askari_banking?hl=en?hl=en
Management:       https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing:           https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group:          http://groups.google.com/group/askari_mis?hl=en

--
We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com,
To post to this group, send email to vuaskari_com@googlegroups.com
Visit these groups:
This (Main) Group:http://groups.google.com/group/vuaskari_com?hl=en?hl=en
MIT/MCS Group: http://groups.google.com/group/vu_askarimit?hl=en?hl=en
HRM Group: http://groups.google.com/group/askari_hrm?hl=en?hl=en
Banking Group: http://groups.google.com/group/askari_banking?hl=en?hl=en
Management: https://groups.google.com/group/vuaskari_mgt?hl=en
Marketing: https://groups.google.com/group/vuaskari_mkt?hl=en
MIS Group: http://groups.google.com/group/askari_mis?hl=en

Comments

Popular posts from this blog

Updating our Google Account inactivity policy

Every day Google works hard to keep you and your private information safe and secure by preventing unauthorized access to your Google Account with our built-in security protections. And keeping you safe means having strong privacy practices across our products that minimize how long we store your personal files and any data associated with them. We want to protect your private information and prevent any unauthorized access to your account even if you're no longer using our services. Therefore, we are updating the inactivity period for a Google Account to two years across all our products and services. This change starts rolling out today and will apply to any Google Account that's been inactive, meaning it has not been signed into or used within a two-year period. An inactive account and any content in it will be eligible for deletion from December 1, 2023. What this means for you: These changes do not impact you unless you h...

Re: ::: vuaskari.com ::: CS408 - FINAL TERM SUBJECTIVE WITH REFERENCE SOLVED BY UMAIR SAULAT

GREAT WORK On Wed, Feb 20, 2013 at 11:30 PM, Umair Saulat < saulat.umair@gmail.com > wrote: CS408- Human Computer Interaction Solved Subjective Fall Semester 2012   QNo.1    it has been observed that most computer users use menu option for input instead of keyboard accelerator. What is the reason behind it? (2 Marks) Answer:- 1.        Menu options are easier to find. 2.        You don't have to memories the keys for menu option but for key board accelerators you have to memories them REF:: Handouts Page No. 127   QNo.2    Define active intervention.  (2 Marks) Answer:- Active intervention with the participant and actively probes the participant understands of whatever is being tested. REF:: Handouts Page No. 276 QNo.3    what is Ubiquitous Computing? (2 Marks) Answer:- The most profound technologies are those that disappear. They weave themselves into the fabric of everyday life until they are indi...

Re: ::: vuaskari.com ::: : CS604 final term sovled subjective part (eagle_eye)

tnkx bhana :) On Thu, Jul 21, 2011 at 8:02 PM, █▓Binish_Awais█▓ < greyferry@gmail.com > wrote: thanks and wonderfull work done by Tabishh ---------- Forwarded message ---------- From: eagle_eye < fantasy.fear@gmail.com > Date: Thu, Jul 21, 2011 at 12:50 AM Subject: CS604 final term sovled subjective part (eagle_eye) To: "Binish(ferry ID}MBA" < Greyferry@gmail.com > --             eagle_eye Live to  EXPRESS  not to  IMPRESS. .!!        ( eagle_eye )                        GMAIL: fantasy.fear@gmail.com   skype ID: fantasy.fear Facebook:  tereass_pass2917@yahoo.com --   ●●Gяєу_Fєяяy ●● --   ●●Gяєу_Fєяяy ●● -- We say, "Be one as Pakistani Nation and grow up for Pakistan's Future". Wish you all the best. Join www.vuaskari.com , To post to this group, send email to vuaskari_com@googlegroups.com Visit these groups: This (Main) Group: http://groups.google.com/group/vuaskari...