Professional Documents
Culture Documents
In this project you are required to store a database using an appropriate data structure which
can be used to answer given list of simple queries. Consider a many-many relationship that
exists between students and courses that they register i.e., each student can register for multiple
courses and each course has multiple students registered. The input format is explained below.
You are supposed to read the input, create an appropriate data structure to represent it, and
then interactively answer the query input by the user until he/she quits. The list of queries is
given below. The output generated in response to the queries must have course number, course
title, and course credits wherever applicable. When multiple courses are being displayed, they
should always be displayed in the non-increasing order of number of credits. Assume that all
registrations are for credit, not audit. The grading system and GPA calculation are same as
those of IISc (check section 1.5.5 1 ). Assume that the default grade during registration is ‘U’
(unassigned). The grades can then be modified using queries 21 and 22. The grade U should
not be considered while calculating GPA.
List of queries
---------------
1
21. ASSIGN GRADE <grade> TO STUDENT <student name> FOR THE COURSE <course number>
22. ASSIGN GRADES FOR THE COURSE <course number>
< and > are not part of the syntax of queries. <number> is an integer with: value not more
than 6 for query 8, value not more than 99 for query 11, value in {1, 2, 3, 4, 5} for queries 12
and 13, value not more than 30 for query 15, and a float value in [0, 10] for queries 17 and
18. <grade> can take values from {A+, A, B+, B, C, D, F}. Queries are strictly in the format
listed above (upper case characters, and sequence of words in the query). The serial number at
the beginning of the query is not a part of the query. Queries with one or more errors can be
rejected with appropriate message being output.
Each query will modify or display the data as applicable. Query 22 is an interactive modify
query that iteratively asks the grade of each student. The examples of two display queries, two
modify queries, and the interactive modify query 22 are given below. User inputs are denoted
in bold for the sake of clarity.
2
Input Data Format for Initial Student Registration
The system must also permit a batch registration system with simple input as below. Each line
consists of <student name> and <course number> separated by a comma and blanks.
Srikant, 456
Aparajita, 2
Manjari, 78
Such input will be used to populate the system with initial data and interactive queries will
operate on this data to begin with. Obviously, the data gets modified due to some of the queries.
After displaying the result of every query, the user should be asked if they wish to ask another
query or stop at that point.