Sponsored Links


+ Reply to Thread
Results 1 to 3 of 3

Thread: CS201 Introduction to Programming Assignment No 5 Solution fall January 2012

  1. #1
    Super Moderator Vuhelper's Avatar Users Flag!
    Join Date
    Apr 2011
    Posts
    7,900

    NEW CS201 Introduction to Programming Assignment No 5 Solution fall January 2012

    Sponsored Links


    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

    ------------------------------------------------------------------------.

    .

    .

    .

    .

    .

    .

    ------------------------------------------------------------------------

    Sponsored Links


    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.


  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    1
    any body share here idea solution of assignment 5 cs201

  3. #3
    Super Moderator Vuhelper's Avatar Users Flag!
    Join Date
    Apr 2011
    Posts
    7,900
    Only the registered members can see the link. Register here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 0
    Last Post: 01-11-2012, 10:09 AM
  2. Replies: 12
    Last Post: 12-27-2011, 01:44 PM
  3. Replies: 63
    Last Post: 01-11-2011, 10:52 PM
  4. Replies: 5
    Last Post: 11-21-2010, 08:51 PM
  5. Replies: 0
    Last Post: 05-16-2010, 12:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Pknews |Vugurus|Online Education