You are on page 1of 3

Mini Project for E0 251

Due date : 30-May-2021, 11.59 PM

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. GET ALL STUDENTS REGISTERED FOR THE COURSE <course number>


2. GET ALL COURSES <student name> HAS REGISTERED FOR
3. GET ALL STUDENTS REGISTERED FOR BOTH THE COURSES <course number> AND <course number>
4. GET NUMBER OF STUDENTS REGISTERED FOR <course number>
5. REGISTER STUDENT <student name> FOR THE COURSE <course number>
6. UNREGISTER STUDENT <student name> FOR THE COURSE <course number>
7. HAS STUDENT <student name> REGISTERED FOR THE COURSE <course number> ?
8. GET ALL STUDENTS WHO HAVE REGISTERED FOR MORE THAN <number> COURSES
9. GET A LIST OF ALL STUDENTS
10. GET A LIST OF ALL COURSES
11. GET ALL COURSES WHICH HAVE MORE THAN <number> STUDENTS
12. GET ALL <number> CREDIT COURSES <student name> HAS REGISTERED FOR
13. GET ALL <number> CREDIT COURSES
14. GET THE TOTAL NUMBER OF CREDITS <student name> REGISTERED FOR
15. GET ALL STUDENTS WHO REGISTERED FOR AT LEAST <number> CREDITS
16. GET A LIST OF GRADES AND THE GPA OF STUDENT <student name>
17. GET A LIST OF ALL STUDENTS WHO HAS A GPA BELOW <number>
18. GET A LIST OF ALL STUDENTS WHO HAS A GPA ABOVE <number>
19. GET A LIST OF ALL STUDENTS WHOSE GRADE IS <grade> AND ABOVE IN <course number>
20. GET A LIST OF ALL STUDENTS WHOSE GRADE IS BELOW <grade> IN <course number>
1
https://iisc.ac.in/wp-content/uploads/2021/02/SIH-2020-21.pdf

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.

GET ALL COURSES WHICH HAVE MORE THAN 15 STUDENTS


251, Data Structures and Algorithms, 5
37, Game Theory and Mechanism Design, 4
CONTINUE(y/n)?y
HAS STUDENT Srikant REGISTERED FOR THE COURSE 45 ?
YES
CONTINUE(y/n)?y
REGISTER STUDENT Manohar FOR THE COURSE 25
CONTINUE(y/n)?y
ASSIGN GRADE C TO STUDENT Manohar FOR THE COURSE 25
CONTINUE(y/n)?y
ASSIGN GRADES FOR THE COURSE 37
ASSIGN GRADE TO Manohar:B+
ASSIGN GRADE TO Srikant:A
ALL STUDENTS ARE ASSIGNED.
CONTINUE(y/n)?n

Input Data Format for Courses


The input will be in the form of COURSE NUMBER, COURSE TITLE, CREDITS pairs separated by a
comma, one pair per line. Assume that there is no redundancy in input (i.e., the same pair may
not be repeated). COURSE NAME is a multi-word phrase and can consist of alphabetic characters
(lower case and upper case) only, with words being separated by any number of blanks (but not
split across lines). There is no need for any validity check on either course number or course
name. COURSE NUMBER is a single integer (upto 4 digits only). The limit on the number of
courses a student can register is 6. The limits on the total number of students and the number
of courses that the system permits are 100 and 20 respectively. CREDITS of a course can be one
from the set {1, 2, 3, 4, 5}.

Example course data input:

251, Data Structures and Algorithms, 5


4512, Database Systems, 4
3, Introduction to Programming, 3

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.

Example registration data input:

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.

You might also like