Skip to main content

Posts

Showing posts from 2009

RRS - Module 6

Integrate all the modules properly so that the Railway Reservation System works efficiently. Run and test all the modules properly. Take care of exceptions if any in the system.

RRS - Module 5

Before we start with this module, verify if you have completed with the previous module. Only after you complete with it, should you start with this module. In this module we would enable the user to cancel his reserved tickets. A user can cancel reserved ticket and the fare is refunded according to the rules given. Cancellation Rules: TICKETS on which Reservations has been made. If a ticket on which reservation of a seat or berth has been made, is presented for cancellation, refund of fare shall be made after deducting cancellation charge from the fare as follows :- If a ticket is presented for cancellation more than 12 hours before the scheduled departure of the train cancellation charge shall be deducted at the flat rate of Rs. 50/- for A.C Class and Rs. 20/- for Sleeper class. If the ticket is presented for cancellation within 12 hours and up to 3 hours before the scheduled departure of the train, cancellation charges shall be 10% of the fare paid. (Rounded off to neares...

RRS - Module 4

In this module let us create Ticket objects and allow the user to book his tickets Users cannot book tickets for unscheduled trains. The user needs to check the schedule and the availability of tickets for a train and then only book tickets. Steps to be followed to create Ticket objects: Create a base class called Ticket, by identifying the common attributes of a Ticket Create 2 derived classes called, AC_Ticket and SC_Ticket, for the above given base class (AC_Ticket is for AC class and SC_Ticket is for sleeper class) Steps to be followed for Reservation part in this module are: Login as User Check Schedule of the trains available Check the availability of berths If available berths are there, allow the user to book tickets – AC or Sleeper A User can book maximum of 2 tickets at a time. There is a single pnr number given. Save the tickets in the folder that contains that particular train and the required day. Display the ticket to the user in a neat format ...

RRS - Module 3

In this module, let us create Train objects and allow Admin to schedule the trains for a week. Steps to be followed in this module: Create a class called Train by identifying its member variables Write the code for the Interface Menu. Login as Admin and do the following Add new trains Save the objects in file Schedule the trains for that week. (Note: Check the assumptions we made at the beginning of this project regarding scheduling) While scheduling, the folder structure to be created is RRS\TrainData\TrainNo The entire schedule could also be written into a file Display the schedule Logout from Admin Interface and log into the User Interface Display the schedule based on train Display the schedule based on Source and Destination Display the schedule based on Date Display all the trains scheduled Note: Make sure that all the display functions print the details in a neat tabular format

RRS - Module 2

You have identified the objects and their members in the previous module. In this module, let us start the project by first creating the two main important objects – User and Admin Steps to be followed in this module: Create a base class called Person, by identifying the common attributes of user and admin Create 2 derived classes called, User and Admin, for the above given base class Write the code for the Interface Menu. Initialize the system by creating an object for Admin class Save the Admin object in a file Create two interfaces where one is for Admin and the other is for User Login as the Admin and do the following Add new users Save the objects to the file Display the User Details. To achieve this read the details from the file sequentially as objects and display the details in a tabular format. Logout from Admin Interface and login to the User Interface. Do the following: Display his own details User should be able to change his own details.

Mini Project - Railway Reservation System

Module 1 Overview Railway Reservation System-(RRS) Project is developed to help students learn and realize capability of C programming language, and appreciate procedural approach of developing a system. RRS helps users reserve/cancel berths, search for trains, check reservation/cancellation history, etc... On the other hand it helps the railway reservation officers to prepare reservation charts, organize train schedules, etc... RRS provides two types of log-ins one is the User log-in for railway customers and the other one is Admin log-in for railway reservation officers. Project is divided into 10 modules of four hours duration each. All the modules will give exactly what to develop in the 4 hour time frame. Since most of the modules are inter-related it is important to keep track of the previous code. After submission it is allowed to make changes in the previous code to suit / integrate well to the system. Before we start the project, we need to make the followin...

Standard Template Library

Learning Objective At the end of this module, you will be able to: Understand Standard Template Library Explain the need of STL Understand and use the vector and list of STL. Using real world objects with STL. Standard Template Library Introduction The Standard Template Library (STL) is a fundamental part of the C++ Standard, is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science. The STL is a generic library, meaning that its components are heavily parameterized: almost every component in the STL is a template. You should make sure that you understand how templates work in C++ before you use the STL. The STL contains several kinds of entities. The three most important are containers, algorithms,and iterators. A container is a way that stored data is organized in memory. In earlier chapters we’ve explored two kinds of containers: stacks and linked lists. Another containe...

Streams & Files

CPP09 W2 M1 Streams and Files Learning Objective Understanding streams Understand the stream class hierarchy Understand the concepts of stream insertion and extraction Use streams for file input and output Distinguish between text and binary file input and output Write programs for random access of data files using: get pointer put pointer seekg() tellg() seekp() tellp() Streams and Files Introduction In simple words, a stream is a sequence of bytes. In input operations, the bytes are transferred from a device (a keyboard, a disk drive, a network connection etc.) to the main memory. Where as in case of output operations, this is reverse. That means, the bytes are transferred from main memory to a device such as a display screen, a printer, a disk drive, network connection, a tape( a file on tape) etc. Streams In C++, a stream is a source or destination for collection of characters. Streams are of two types: Output stream In...

Exceptional Handling

CPP09 - W1 - M10 - Exception Handling Learning Objectives At the end of this module, you will be able to * Explain why do we need exception handling. * Explain how to write C++ programs using exception handling. * Explain how to declare and implement exception handing. * Identify and list different exceptions. * Apply exceptions for file handling, memory allocation and real world scenarios. Exception Handling Introduction Exceptions are errors that occur at runtime. They are caused by a wide variety of exceptional circumstance, such as running out of memory, not being able to open a file, trying to initialize an object to an impossible value, or using an out-of-bounds index to a vector. Why do we need exceptions ? Why do we need a new mechanism to handle errors? Let’s look at how the process was handled in the past. C-language programs often signal an error by returning a particular value from the function in which it occurred. For example, disk-file functions often r...

Static Polymorphism

CPP09 W1 M1: Static Polymorphism: Templates Learning Objectives At the end of this Module, you will be able to: Explain how to achieve static polymorphic behavior through the use of templates Explain how to write generic code using templates Explain how to declare and implement function templates Explain how to declare and implement class templates Explain how to declare and implement class member function templates Static Polymorphism Introduction Static polymorphic behavior is realized at compile time. A class template acts as a generic class definition from which new class types can be defined by a simple change of parameter types. Whereas a normal class is used to create objects, a class template is used to define new class types, from which objects are then created. The compiler uses the types you supply, combined with the class template, to create a wholly new class type. Understanding how to declare, implement, and use class and function templates will p...