Sie sind auf Seite 1von 12

ANNA UNIVERSITY:CHENNAI 600 025

B.E/B.Tech. DEGREE EXAMINATIONS, NOV./DEC.-2014

Regulations 2013
Third Semester
B.Tech. Information Technology

IT6311: PROGRAMMING AND DATA STRUCTURES LABORATORY II

Time: 3 Hrs. Maxi. Marks: 100

(1) 1. Develop a flight reservation system to computerize the calculation of the flight
ticket amount. Create a class Flight which has data members flight_no, flight_name,
source and destination. There are two types of flights such as budget & non-budget
flights. Flight ticket calculation definition will be different for different types of flights.

Budget flight need to get information about the type of food (veg/non-veg), TV facility
(Boolean), Beverages (Boolean) from the user. Non budget flight includes everything
automatically.

For Budget flights,


Flight ticket calculation = ticket charge + charge for food + TV facility + Beverages
Charge for food (randomize), TV facility - Rs. 50/-, Beverages Rs.100/-

From To Flight Charges


Chennai Colombo Rs. 3407/-
Delhi Dubai Rs. 15,073/-
Bangalore Dubai Rs. 15,937/-
Mumbai Muscot Rs. 10,089/-
Hyderabad Dubai Rs. 17,330/-
Mumbai Singapore Rs. 18,329/-
Delhi Hong Kong Rs. 21,365/-
Mumbai New York Rs. 59,669/-
Delhi London Rs. 39,098/-
Table . 1

Read and display details of two different types of flights using stream operator
overloading (<<,>>) (20)
Write suitable exceptions for the given scenario (10)
Implement the flight_ticket_calc() in two different types of flights and invoke
them
(Use virtual function) (30)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the following member functions
Create_Graph() to represent the graph using Adjacency matrix.
(10)
DFS() to perform depth first search on the graph.
(30)
(2) 1. Develop Reward System for the faculty members of the college. Create a class
which has data members namely faculty_id, faculty_name, mobile_no and email-id.
There are two categories of faculty such as cse_faculty and mech_faculty. Each category
has the data members subject handled by that faculty and marks[10] consists of marks
scored by the students in that subject. Reward_for_faculty definition will be different for
different types of faculty. Sample Table showing the marks is given below:

Marks for Marks for Marks for Marks for Marks for
S1 S2 S3 S4 S5
34 50 89 92 10

Pass percentage: (no_of_students_passed/total_no_of_students )*100


Class Average: (s1+s2+s3+s4+s5)/5
CSE_Faculty will be rewarded when pass percentage is >90 & class average is 60%
Mech_Faculty will be rewarded when pass percentage is >70 & class average is 50%

Read ten cse_faculty objects using array of objects


(10)
Write the details of entire cse_faculty objects in a binary file and display the
contents of the file by reading from it.
(20)
Implement reward_for_faculty() to find whether the faculty will be rewarded or
not in two different types of faculty members and invoke them (use virtual
function) (20)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix (10)
Prims Algorithm to construct minimum spanning tree.
(40)
3. 1. Develop hospital information system for computerizing the operations in the
hospital. Persons may be patients or employees in that hospital. Hence, person has name,
age, address, contact_no. Admission fees method definition will be different for different
types of persons. Include suitable menu for navigating the application.

Patient has patient-id, disease, admission (yes/no)


Employee has emp-id, designation, admission (yes/no)
Admission fees no concession for admission fees (admission fees = 1000) for the
patients. But employees of the hospital have some concession to avail as follows

Designation % of deduction in admission


fees
Doctor 80%
Nurse 30%
Ward boy 40%
Receptionist 20%
Table 1
Write the details of the Table 1 in a binary file hospital.dat and use the contents
of the file in admission method.
(20)
Implement the admission_fees method() in two different types of persons and
invoke them (use virtual function)
(30)

2. Create a class BST with the data member node which is of type structure. This
structure consists of the members namely element of type integer, left and right which are
of type pointer to the structure node. The other data member for the class is root which is
a pointer to the node structure. Write the following member functions
Insert() To insert an element into the binary search tree
(20)
Search() To search for a given element in the tree
(10)
Inorder() To perform inorder traversal for tree
(10)
FindMin() To find the minimum element in the tree
(10)
(4) 1.Create class distance with the data members feet and inches of type integer.
Overload the following operators and write the operator functions necessarily as
member or friend of the class distance.
>> (extraction operator) to read the values for the data members
(10)
<< (insertion operator) to display the values of the data members
(10)
+ (addition operator) -- to add two distance objects
(10)
-(unary minus) to negate the feet and inches of distance
(10)
++(pre and post increment operator) to increment the values of the data
members of a distance object
(10)
Write the main() program to demonstrate the distance object for unary and binary
operator overloading.

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix (10)
Prims Algorithm to construct minimum spanning tree.
(40)

(5) 1.Design a class Array as a template class with a single dimensional array and size of
the array as data members. Template class needs to work for different types of input
(integer, float, char, char array, string, student, employee). Student object has the data
members (rollno, name). Employee object has the data members (empno, name). Include
the following member functions

getArray() and printArray() to read and print the elements of the array
(10)
search() to search a given element in the array
(20)
To enable searching employee or student objects based on a data member
(20)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix (10)
Implement Dijkstras shortest path algorithm for the Graph from a given
source vertex (40)
(6) 1. Write a function template to search for a given element in the array whose input
values may be of type integer, float, char array, string and Student objects. Student
objects need to be searched based on their total.

To search for a given element in the set of integer, float and string values
(10)
To search for a given element in the set of strings made up of character array (use
template specialization)
(20)
To search for a student object based on the total
(20)

Create a class student with the data members roll number, name, marks array to hold
marks for 5 subjects, total and a boolean variable pass. Keep the following member
functions in the class.

Void Read() To read the data members


Void Print() To print the data members
Void Result() Computes the total and pass. Pass variable will be true if all
the
marks are >=50, otherwise, it is false.
(10)

2. A stack is a linear list of elements for which all insertions and deletions (usually
accesses) are made at only one end of the list. Create a class with the data members
integer array and the size. Write the following member functions
Push (int X): pushes an element X on to the top of the stack This function
uses the IsFull() member function while pushing the data.
(10)
int Pop(): pops the last pushed element. This function uses the IsEmpty()
member function while popping the data from the stack .
(10)
Write a program to find whether the given string is palindrome or not. (Use
stack class).
(20)
(7) 1.Create a class Capacity with the data members litre and milli litre of integer type.
Write the following member functions.
Read and print the measures using stream operator overloading (<<, >>)
(20)
Write ten measures into a binary file input.dat
(20)
Open the file, read the measures using input file stream and perform addition of
two measures at a time (use operator overloading)
(10)
Store the resultant measure in another file.
(10)

2. Create a class BST with the data member node which is of type structure. This
structure consists of the members namely element of type integer, left and right which are
of type pointer to the structure node. The other data member for the class is root which is
a pointer to the node structure. Write the following member functions
Insert() To insert an element into the binary search tree
(20)
Preorder() To perform preorder traversal for tree
(10)
FindMax() To find the maximum element in the tree
(10)

(8) 1. Create a class Electricity with the data members consumer_number, name,
units_consumed and bill_amount. Write the following member functions in the class.

To read and display the data members of Electricity class


(10)
Compute_bill() To compute the electricity bill
(10)
If Units_Consumed < 200 Rs. 2
If Units_Consumed between 201 to 300 Rs. 3.50
If Units_Consumed >300 Rs. 5
Create a binary file detail.dat and insert 10 Electricity objects in it
(20)
Find() To find the Electricity record given the position of it from the file
(20)

2. Create a class Graph with the data members adjacency matrix and the number of
nodes of type integer. Write the following member functions
Create_Graph()to represent the graph using Adjacency matrix
(10)
DFS() to perform depth first search on the graph
(30)
(9) 1. A Queue is a linear list of elements where an element will be inserted at back end
and deleted from front end. Create a class template queue with the data members
generic array (integer, char, float, string values), front and rear. Include the following
member functions in the class queue and write a menu driven (1. Insert, 2. Delete, 3.
Display, 4. Exit) program to use the class queue.

bool IsEmpty(): return whether the queue is empty or not


(10)
bool IsFull(): return whether the queue is full or not.
(10)
Insert (int X): inserts an element X into the back end of the queue This
function uses the IsFull() member function while inserting the data.
(10)
Int Delete(): removes the element from the front end. This function uses the
IsEmpty() member function while deleting the data from the queue.
(10)
void Display(): to display the elements in the queue.
(10)
Write suitable exceptions for the given scenario
(10)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the following member functions
o Create_Graph() to represent the graph using Adjacency matrix
(10)
BFS() to perform breadth first search on the graph (use queue class)
(30)

(10) 1. Create a class Items with a data member itemlist whose type is a double
pointer. The memory space for this double pointer is allocated in the constructor of the
class. Write a destructor to de-allocate the memory of the character array. Include the
following member functions:

Read(), Disp() to read and display the data member itemlist


(20)
Create suitable constructor and destructor for the class Items
(20)
Copy constructor to copy data members from one object to the other
(20)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the following member functions
Create_Graph() to represent the graph using Adjacency matrix
(10)
DFS() to perform depth first search on the graph
(30)
(11) 1. Consider an example of calculating the net pay. Design three classes: Employee,
Allowances and Salary. The Employee class has data members namely emp_number,
name and address. Create the class Allowances by inheriting the Employee class. The
Allowances class has data members BasicPay, PF and HRA. Derive the Salary class from
the Allowance class and it has its own data member NetPay which is of type float.
Include getPay() in Salary class to set the NetPay which is calculated as BasicPay+HRA-
PF.
Write an interactive program to model this relationship (use Inheritance)
(20)
Write a friend class to maintain the collection of salary objects and include a
member function to list the employee details (emp_number, name, NetPay) based
on the address. (30)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix (10)
Kruskals Algorithm to construct minimum spanning tree
(40)

(12) 1. Create a class called Circle with radius as data member and getCircle() and
calcArea() as member functions to read the radius and calculate area of the circle.
(10)
Create a class called Cone which is derived from the Circle class. Utilize the data
members and the member functions of the base class by the derived class to find the
volume ((1/3)*3.14*r*r*h) of a cone. Create another class called Cylinder which is
derived from the Circle class. Utilize the data members and the member functions of the
base class by the derived class to find the volume (3.14*r*r*h) of a cylinder.
(10)
Get and retrieve the data members of cone and cylinder using operator
overloading (<<, >>)
(20)
Use virtual function to find volume of the cone and cylinder and invoke them
(10)

2. Create a class BST with the data member node which is of type structure. This
structure consists of the members namely element of type integer, left and right which are
of type pointer to the structure node. The other data member for the class is root which is
a pointer to the node structure. Write the following member functions
Insert() To insert an element into the binary search tree
(20)
Delete() To delete a given element from the tree
(20)
Postorder() To perform postorder traversal for tree
(10)
(13) 1. Create a class Vector with the data members **m, row and column of type
integer. Write the following member functions
Overload stream operators (<<, >>) to read and display the vector
(20)
Overload binary minus (-) operator to subtract one vector from the other
(10)
Overload unary minus (-) operator to subtract the values of the elements of a
given vector
(10)
Allocate memory for the data member m using constructor
(10)
Deallocate the memory for m using destructor
(10)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the following member functions
Create_Graph() to represent the graph using Adjacency matrix
(10)
DFS() to perform depth first search on the graph
(30)

(14) 1. Write a program to create a list container (STL) to maintain a set of float
elements and student objects where student object consists of the data members name and
rollno. Implement the following
Create a list of float elements using list container
(10)
Insert into a list with the new element in the given required position
(10)
Create a list of student objects using list container
(10)
Insert into a list with a new student object in the given required position
(20)
Display the list of student objects from the List container
(10)

2. Create a class BST with the data member node which is of type structure. This
structure consists of the members namely element of type integer, left and right which are
of type pointer to the structure node. The other data member for the class is root which is
a pointer to the node structure. Write the following member functions
Insert() To insert an element into the binary search tree
(20)
Delete() To delete a given element from the tree
(10)
Postorder() To perform postorder traversal for tree
(10)
(15) 1. Create a class Date with day, month, and year as data members.
Write the following member functions
To read and display the Date separated by: (DD:MM:YY)
(10)
If the input value exceeds the day, month and year (valid from 1974-2015) then
your function should report the exception as invalid date/month/year
(20)
Write an operator function binary minus (-) to find which date is later. For
example invoking D1-D2 displays D1 is later or D2 is later
(20)

2. Create a class Graph with the data members adjacency matrix and the number of nodes
of type integer. Write the member functions to implement
Adjacency matrix creation
(10)
Kruskals Algorithm to construct minimum spanning tree
(40)

(16) 1. Create a class Student with the data members rollno, *name, mark array
containing marks for maths and science subjects and cutoff mark. Include member
function calculate_cutoff() to find cutoff where cut off mark is calculated as
((maths+science)/200)*80. (10)
Create another class Rural with the data members area, annual_income. Include member
function calculate_ruralmark() to calculate rural_mark from their data members. Input for
area is Backward or Most Backward. For Backward area, score is 5, otherwise 10.
Similarly if annual income is <10000, score is 10 and if it is within 20000, score is 5
(10)
Create another class Rural_Student derived from both the Student and Rural with data
member total_cutoff and calculate total_cutoff() to add the cutoff and rural_mark.

Model this relationship using inheritance


(20)
Allocate memory for the data member name using constructor
(10)
Deallocate the memory for name using destructor
(10)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the following member functions
Create_Graph() to represent the graph using Adjacency matrix.
(10)
DFS() to perform depth first search on the graph.
(30)
(17) 1. Write a program to create a map container (STL) to maintain a set of key value
pairs, where key is string element or person object and value is the AGE (within 100).
Person object has the data members name and address. Display the elements of the map
container.
Create a map container with 10 key, value pairs in which string element is the key
and age is the value
(10)
Display the string key, value pairs from the Map container
(10)
Create a map container with 10 key, value pairs in which person object is the key
and AGE is the value
(20)
Display the person key, value pairs from the Map container
(10)

2. Create a class Graph with the data members adjacency matrix and the number of nodes
of type integer. Write the member functions to implement
Adjacency matrix (10)
Floyd-Warshall algorithm to find the shortest path between every pair of
vertices in the graph
(40)

(18) Create a class student with the data member rollno. Create a class test which is
derived from student with the data members part1 and part2 of type integer. Another
class sports that is derived from student has the data member sports_mark. A class result
that is derived from both test and sports has the data member total.
Model this hierarchy using inheritance
(10)
Read and display the data members for the object result (use operator (<<, >>)
overloading)
(20)
Write compute_total() to find the total marks by adding part1, part2 and
sports_mark (10)
Write suitable exceptions for the given scenario
(10)

2. Create a class Graph with the data member 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix creation
(10)
Kruskals Algorithm to construct minimum spanning tree
(40)
(19) 1. Write program to find maximum of two numbers from given two numbers. (Use
function overloading). These two numbers may be of int, long, float, double and string.
Write main() program to demonstrate the function overloading
(20)
Create a text file sample.txt. Write ten sentences into sample.txt, read and display
them by opening it in read mode.
(20)
Throw suitable exceptions for the scenario (divide by zero error)
(10)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix creation
(10)
Kruskals Algorithm to construct minimum spanning tree
(40)

(20) 1. Create a class matrix with the data members **m, row and column of type integer.
Include the following member functions
Read and display the data members of the matrix
(10)
Facilitate invoking 5+M or M+5 (using operator overloading, friend function)
(20)
Allocate memory for the data member name using constructor
(10)
Deallocate the memory for name using destructor
(10)

2. Create a class Graph with the data members 2D array and the number of nodes of type
integer. Write the member functions to implement
Adjacency matrix creation
(10)
Prims Algorithm to construct minimum spanning tree
(40)

Das könnte Ihnen auch gefallen