Assignment No. 03
CS201: Introduction to Programming
Total Marks: 20
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files, no reward will be given in any case.
The objective of this assignment is to provide hands on experience of:
Problem Statement: Flight Reservation System
Write a program for Flight Reservation System which reserves the tickets for passengers of an Air Line according to their requirements.
In the program, you are required to make a structure with name 'Reservation' and following are the data members of structure.
ñ Passenger Name
ñ Passenger Address
ñ Date of flight
ñ Destination to travel
ñ Flight No
ñ Seat No
In the main() function, create of variable of type Reservation. The variable of type Reservation should be created dynamically using memory allocation function. After that, create following user defined function as discussed below:
GetData(), this function will set the values of above created structure variable according to the inputs taken from user. It will prompt user to enter required information for the, Passenger Name, Passenger Address, Destination, Date of flight. User will be provided three options for the destination that is: Karachi, Lahore and Peshawar.
Assigning Flight No and Seat No:
The user will chose one of three destinations and program will assign an appropriate Flight No for the passenger. The Flight No will be assigned as below:
Destination Flight No.
After Assigning Flight No, the Seat No. will be assigned randomly which can be any number from 0 to 200.
After assigning the values for the above created variable of Reservation structure, the structure will be passed to another user defined function WriteData() for writing it to the file.
In the function WriteData(), you are required to create a new text file name “data.txt” in same folder/directory where you have saved your .cpp file. Open this file by using file handling functions and then write all Reservation information in that file.
At the end, read all the data from file by creating a function named ReadData() and display the file contents on the screen.
Points To Remember:
Following points should be kept in mind and handled accordingly, otherwise marks will be deducted.
ñ Reading and writing from text file, must be done with standard file handling functions provided in handouts.
ñ All data members must be declared and initialized with appropriate data type.
ñ Exceptional cases must be kept in mind and handled accordingly while taking input from user.
ñ User must be prompted if there is any error while:
◦ Creating a file.
◦ Opening a file for reading/ writing.
Please Discuss here all about this assignment.Thanks
:D is baar m thinking not to make the assignment :D
please dont do at this, please help us
i can't promise but Insha'Allah i will let u guys know jb mein kuch kr lon gi to .... gonna start working on this assignment ... time thora reh gaya hai .... to may be assignment pori na ho pae ... but still something is better than nothing
CS201 Assignment 3 Solution Fall 2011
#define PI 3.14
radius = 0;
radius = r;
double Circle::calculateArea(double r)
double Circle::calculateCircum(double r)
cout "Radius of the Circle is " Circle::radius endl;
cout "Area of the Circle is " calculateArea(Circle::radius) endl;
cout "Circumference of the Circle is " calculateCircum(Circle::radius) endl endl;
Sir ... ye koi or solution hai :S ye wali assignment nai hai hmari :S
AoA tariq bhai
plz upload the real solution
or some guideline
plz bro hlp us kal last date h r aj kal light ka b down falll h plz aj solution bta dny tak jb b light o hm kal tk kr lny
please help me...i got very bad marks in ths paper already...could not understand it..please help me
someone plzzzzzzzz help ........ tomorrow is the