Vous êtes sur la page 1sur 3

Design and develop an application to manage the trains of Indian Railways.

The admin
should be able to add new, update, delete and view the trains. The admin can add new
trains by providing the details like Train No, Train Name, Source Station, Destination
Station, Departure Time, Arrival Time, No. of Coaches and Fare. The admin of the system
can also view a particular train details, and modify them.
1. Design a Train class with the following fields:
i. Train No (5 digit Unique number)
ii. Train Name
iii. Source Station
iv. Destination Station
v. Departure Time
vi. Arrival Time
vii. No. of Coaches
viii. Fare
2. Design an Interface for Railway Management as IRailway with the following
members:
i. Long AddTrainDetails(Train t)
ii. Train FindTrain(long TrainNo)
iii. List<Train> ViewTrainDetaisl()
3. Create a class IndianRailway to implement IRailway.

i.
ii.
iii.

Long AddTrainDetails(Train t) Add Train Details using Stored Procedure


created in 5 and Return Train No generated for the given details
Train FindTrain(long TrainNo) Write ADO.NET Code to return the train
details for the given train number
List<Train> ViewTrainDetaisl()

4. Create the table Train_Details with the following columns.

Train_Details
TrainNumber numeric(5) not null Identity(10001,1)
TrainName varchar(40) not null
Source Station varchar(40) not null
Source_Departure_Time varchar(10)
Destination Station varchar(40) not null
Destination_Arrival_Time varchar(10)
Number of Coaches int check value between 0 and 200
Fare money check fare is above 1 and below 2000

5. Modify the table Train_Details to do following operations:


i. add primary key constraint on TrainNumber field

ii.

Use SET IDENTITY_INSERT TrainDetails ON and insert values into


TrainNumber field as mentioned below.
Destinatio
n Arr.
Time
03:10 Pm

NumberOf
coaches
20

Fare

11:45 Am

20

280

09:50 Pm

20

280

09:40 Am

15

320

11:50 Pm

Secunderab
ad Jn
Vijayawada
Jn
Kakinada
Port
Puducherry

06:45 Pm

20

450

New Delhi

10:10 Pm

Lucknow Nr

06:45 Am

25

480

Gaya Jn

02:30 Pm

New Delhi

05:00 Am

15

350

Allahabad
Jn

09:30 Pm

New Delhi

06:55 Am

12

TrainNo

TrainName

Source
Station

Source
Dep. Time

Destination
Station

12590

Gorakhpur
Express
Satavahana
Exp
Satavahana
Exp
Circar
Express
Ndls Pdy Exp

Secunderab
ad Jn
Vijayawada
Jn
Secunderab
ad Jn
Chennai
Egmore
New Delhi

07:20 Am

Gorakhpur

06:10 Am

Lucknow
Mail
Mahabodhi
Exp
Prayag Raj
Exp

12713
12714
17643
22404
12230
12397
12417

04:15 Pm
05:20 Pm

6. Answer the following queries with help of the given table:

a) Display the train details of "Circar express"!.


b) List the names of all trains whose source station is "New Delhi".
c) Display all the train details in sorted order based on number of coaches.
d) Display the Source Station and the total number of trains available for each
Source
Station.
e) Find the total number of trains available for destination station as "New
Delhi" and have not more than 15 coaches.
f) Display the Train numbers and its names for which the fare is more than the
average fare. Sort the results in ascending order of Fare.
g) Create a View to display the Train Name, first three letters of source and
destination and Fare for all trains.

300

397

h) Create a Procedure which takes Train Number as input and should return the
corresponding Train Name and Total Fare using output parameters.
i) Create a procedure to insert train details into Train_Details table.

Instructions:

TO UPLOAD: Copy all SQL Script Files and C# Project File along with its .CS files to a
folder, Zip the folder and then upload it into iON.

Follow naming conventions and coding standards.

All DB tables should prefix with tbl and suffix with _EmployeeID (Ex:
tblTrain_432123) and Stored Procedures prefix with usp_ and suffix with
_EmployeeID (Ex: usp_FindTrain_432123)

Vous aimerez peut-être aussi