Assignment No. 05
Semester: Fall 2011
CS201: Introduction to Programming Total Marks: 20
Due Date:26/01/2012
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:
Classes
Function Overloading
Dynamic Memory allocation in C/C++
String Manipulation Functions
File Handling
Stream Manipulators
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: 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:
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 Destination Ticket Price
Economy Class Karachi 3000
Economy Class Peshawar 2500
Economy Class Lahore 4000
Business Class Karachi 5000
Business Class Peshawar 4500
Business Class Lahore 6000
First Class Karachi 7000
First Class Peshawar 7000
First Class Lahore 7000
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.
CS201_5th_Assignment_Fall_2011
Moderator: abdulsaboor
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
Re: CS201_5th_Assignment_Fall_2011
AOA,
Before you run for the download, PLEASE READ!!!
We have been and we will keep on providing you the guidance and solution for your academic problems free of cost.
But there is something, that we must care of, and that is copy rights.
Our team works hard and does the job well, but there are the other similar sites and forums
who are just going to copy the solution from us and publishing with their own names.
Thats what we can never tolerate, NOT AT ALL.
We are not demanding for money but just appreciation for our team which is only a click away.
You can use the thanx button and encourage the person who shares the solution but only a few will do that not all???
Is it hard enough?
Any way here we have the compiled form of assignment only so you can use and check it.
But Source code will be uploaded by 6PM on 25th just to make surte no other site or forum copy paste it with its name.
HOPE YOU ALL UNDERSTAND THE SITUATION.
Before you run for the download, PLEASE READ!!!
We have been and we will keep on providing you the guidance and solution for your academic problems free of cost.
But there is something, that we must care of, and that is copy rights.
Our team works hard and does the job well, but there are the other similar sites and forums
who are just going to copy the solution from us and publishing with their own names.
Thats what we can never tolerate, NOT AT ALL.
We are not demanding for money but just appreciation for our team which is only a click away.
You can use the thanx button and encourage the person who shares the solution but only a few will do that not all???
Is it hard enough?
Any way here we have the compiled form of assignment only so you can use and check it.
But Source code will be uploaded by 6PM on 25th just to make surte no other site or forum copy paste it with its name.
HOPE YOU ALL UNDERSTAND THE SITUATION.
- Attachments
-
- screenShot.jpg (167.94 KiB) Viewed 12427 times
-
Assign.zip- (257.71 KiB) Downloaded 908 times
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
Re: CS201_5th_Assignment_Fall_2011
AOA, Please download and unzip the attached file which contains a compiled exe file for you to check it working, a screenshot to see it working, and main.cpp file which contains the source code. I have used Visual C++ 6 so if you get any problem with other compilers or any other issue, do let me know, will fix insha Allah.
- Attachments
-
CS201_5th_Assignment_Fall_2011.zip- (259.31 KiB) Downloaded 950 times
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan
Re: CS201_5th_Assignment_Fall_2011
:text-thankyouyellow: :text-thankyoublue:
Re: CS201_5th_Assignment_Fall_2011
:text-thankyouyellow: :text-thankyouyellow: sir
Re: CS201_5th_Assignment_Fall_2011
:text-thankyouyellow: :text-thankyoublue: :text-thankyouyellow: :text-thankyoublue:
-
khanzadakhan
- Visitor
- Posts: 1
- Joined: Mon Jan 23, 2012 9:38 am
Re: CS201_5th_Assignment_Fall_2011
:text-thankyouyellow: :text-thankyoublue: :text-thankyouyellow: