We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 03
Semester: Fall 2011

CS201: Introduction to Programming

Total Marks: 20

Due Date:29/12/2011

 

Instructions:

 

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

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.

 

 

Objectives:

 

The objective of this assignment is to provide hands on experience of:

 

  • Structures
  • Dynamic Memory allocation in C/C++
  • String Manipulation Functions
  • File Handling

 

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ rules while writing variable names, function names etc
  • Use only dev-C++ for this assignment.
  • Use appropriate C/C++ structure i.e. if-else; switch statement etc to get inputs from user where required (Marks will be deducted if inappropriate structure will be used).

 

 

 

 

 

 

 

 

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. 

 

Detailed Description:

 

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.

          Karachi                          201

          Peshawar                         233

          Lahore                           241

 

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.

 

 

 

 

 

 

 

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2174

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

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 #03 Solution Fall 2011

Attachments:

CS201 Assignment 3 Solution Fall 2011

www.vustudents.ning.com

 

 

#include<iostream.h>

 

#define PI 3.14

 

class Circle

{

      public:

              double radius;

              Circle();

              Circle(double);

              double calculateArea(double);

              double calculateCircum(double);

              void display();

      };

     

Circle::Circle()

{

                radius = 0;

                }

               

Circle::Circle(double r)

{

                radius = r;

                }

double Circle::calculateArea(double r)

{

       return (PI*r*r);

       }

      

double Circle::calculateCircum(double r)

{

       return (2*PI*r);

       }

      

void Circle::display()

{

     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;

     }

    

main()

{

      Circle circle1;

      Circle circle2(3.5);

      circle1.display();

      circle2.display();

      system("pause");

      }

www.vustudents.ning.com

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

last date

RSS

Latest Activity

Mumtaz Hussain liked + M.Tariq Malik's discussion CS101 Assignment No 01 Fall 2019 Solution & Discussion
2 minutes ago
+ ! ! ! ! ᎠixieᎠuຮt꧂ liked Usman Mughal's discussion Fall 2019 Assignment No. 1 English Comprehension (Eng101)
2 minutes ago
muddasir and Adil Iqbal are now friends
5 minutes ago
Mohsin pervaiz liked Usman Mughal's discussion Fall 2019 Assignment No. 1 English Comprehension (Eng101)
7 minutes ago
Profile IconNaeem jani and abdul ghafoor joined + M.Tariq Malik's group
13 minutes ago
Profile IconNabeel Ahmed, M IDREES and Abdul Ghaffar joined + M.Tariq Malik's group
30 minutes ago
BILAL Maher replied to + M.Tariq Malik's discussion CS401 Assignment No 01 Fall 2019 Solution & Discussion in the group CS401 Computer Architecture and Assembly Language Programming
48 minutes ago
+¢αяєℓєѕѕ gιяℓ replied to Moji's discussion Assignment #1 Semester FALL 2019 Physics (PHY101)
1 hour ago
Asmat replied to + "J ɨ y ą ⋆'s discussion CS501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 12-11-2019 in the group CS501 Advance Computer Architecture
1 hour ago
+!!! NOOR UL JANAT !!!+ replied to Rana Ali's discussion Alfaz
2 hours ago
Rana Ali replied to Rana Ali's discussion Alfaz
3 hours ago
Rana Ali liked Rana Ali's discussion Alfaz
3 hours ago
Rana Ali liked Rana Ali's discussion Psy511 assignment no 1
3 hours ago
Rana Ali added a discussion to the group PSY511 Environmental Psychology
3 hours ago
Rana Ali liked + M.Tariq Malik's group PSY511 Environmental Psychology
3 hours ago
Rana Ali joined + M.Tariq Malik's group
3 hours ago
Rana Ali liked + M.Tariq Malik's discussion EDU302 Human Development and Learning Assignment No 01 Fall 2019 Solution & Discussion
3 hours ago
MUHAMMAD USMAN replied to MIT's discussion Operating Systems(CS604) Assignment # 01 Deadline Date 16-11-2019 in the group CS604 Operating Systems
3 hours ago
Muhammad Awais replied to Usman Mughal's discussion Assignment No. 01 Semester: Fall 2019 in the group CS101 Introduction to Computing
4 hours ago
Muhammad Awais joined + M.Tariq Malik's group
4 hours ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service