Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.




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.





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


  • Classes
  • Function Overloading
  • Dynamic Memory allocation in C/C++
  • String Manipulation Functions
  • File Handling
  • Stream Manipulators





  • 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:  Airline Fare System

Write a program for air fare System which will calculate fare on already reserved ticket.    


Detailed Description:


In the program, you are required to make a class with name 'airfare' and following are the data members of class airfare.


ñ  Seat type

ñ  Price

ñ  Tax

ñ  Airline charges


In the main () function, create a constructor of class to initialize the class data members. Class must have a destructor. Create following user defined function as discussed below along with class constructors and destructor:


GetData(), this function will take the input for seat type variable from the user and will set the ticket price according to the input taken from user. The function GetData() will prompt user to enter required information for seat type.


Seat Type:

User can select one of the Seat type:


1. First Class Seat

2. Business Class Seat

3. Economy Class Seat


The function GetData() will also read the data from file named data.txt ( created in assignment no 3 ) to read the destination and then assigns the price for the given destination.




Price will be calculated on the basis of following information:


1- Fare type

2- Destination (Desire destination information will be read from the file “data.txt” )


The price will be assigned according to the table given below:





Seat Type


Ticket Price

Economy Class



Economy Class



Economy Class



Business Class



Business Class



Business Class



First Class



First Class



First Class





Airline charges:

All airlines will charge 15% of ticket price extra to the all fare types along with the tax.  


Class should have a user-defined function named CalculateTax() to calculate the tax according to seat type and ticket price.


Tax calculation will be done as below:


If seat type is First class then tax will be 30% of ticket price

If seat type is Business class then tax will be 20% of ticket price

If seat type if Economy class then tax will be 10%  of ticket price



Calculateprice(), this member function will calculate price of already reserved ticket and will display total fare on the screen. Price calculation will add above calculated tax, airline charges to the actual ticket price according to following information.


Fare = Airline Charges + Tax + Ticket Price



In the function WriteData(), you are required to create a new text file name “fare.txt” in same folder/directory where you have saved your .cpp file. Open this file by using file handling functions and then write all air fare information in that file in following format.



Name | Address| Date | Destination | Flight. No | Seat. No | Fare










Required information of Name, Address, Date, Destination, Flight No, Seat No, should be taken from assignment no 3 output file.  


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.









Views: 5139


Replies to This Discussion

:S ... phir se assignment ....

Please Discuss here about this assignment.Thanks

koi faida nai assignment bhjny ka milna sab ko zeroo hiiiii ha....

assignment pay assignment for God let us free for Exam koi tu sir ku inform kray

baki subjects ka b yei haal hai

     koe to kahy in say k rehm karen hm pay........................

Some one share solution of this assignment please.....................

papers se pahle teachers ko chayie tha k koi assignment na dete mgr ...........

jo kui b assignment ka solution bnay wo mujy mail ker day plzzzzzzzzz.........


what the hell uf phr se assignment waln hm par rhm karooooooooooooooooooooooooooooooooooooooooooooooooooooooo

last hai dosto dil chota na karu.ab solution dundu plz .

solution mil b jaega to wo zero hi denge bht chalaak hain, isse behtar hai khud bnakr submit krwao 


Looking For Something? Search Below

Latest Activity

Sara replied to MEHMOOD QADIR's discussion Research Paper
2 hours ago
Sara replied to MEHMOOD QADIR's discussion Research Paper
2 hours ago
Simona replied to MEHMOOD QADIR's discussion Research Paper
2 hours ago
Simona replied to Sara's discussion write my dissertation cheap
2 hours ago
Sara posted a discussion
2 hours ago
Profile IconNoman Ali, Anum Mughal, MUHAMMAD HAMMAD AHMED and 1 more joined Virtual University of Pakistan
2 hours ago
Fakhir replied to иαвєєℓ αнмє∂'s discussion Kya hal hain ning awam?
11 hours ago
Nida Arshad Javaid Ch posted photos
12 hours ago

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

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