LAB 8
Data Entry and display for a set of records
In this lab you have to define a class DataEntry which uses reads in data objects of class IITK_UGStudent. It will ask the user for data regarding his/her
Each of these fields must be verified for correctness within the given norms for these fields. If incorrect the user should be prompted again only for fields that are incorrect.
- name
- roll number
- department (should be one of the set "AE", "CE", "PHY", "CSE" etc)
- date of birth (a string "DD-MM-YY" in EXACTLY - including the "-")
- userid
- webpage (the complete url including http://home.iitk.ac.in/. . . )
- hostel (H1 to H8 or GH)
- room number (number-only, or, if GH, then "wing-number" e.g. "B-221")
There is a primary level of data correctness, e.g. the roll number has a certain syntax; some have Y00 some are 98xxx. In the date of birth - the month must be below 12, and depending on the month and year, the days have limits.
Incorrect field inputs should flag an exception that you will have to define. The exception for the month in the date field is given as an example in the code below.
Other constraints work across fields - e.g. webpage and userid, room number and hostel, but also a given roll number implies that the year of birth should be in a specified range - you cannot be Y02 and be born in 1966. There are a number of different aspects at this level. You can also flag people who have their birthdays in the next week as "birthday approaching".
The input can be online from the console (this is important in the debugging phase), and it should also work with a file in the console mode of java:
java DataEntry < FILENAME
Output
When the user starts, he will see a menu:The display and search record choices will generate a new menu.
- Add a new record
- Delete a record
- Edit a record
- Search records
- Display all records
The Search menu should have two items - Name or Roll Number, and should return all entries that match the query. Name matches must be substrings and not sensitive to case. Thus the search string "ashv" will find "Ashvin Agarwal", "Manashvita ghosh", etc. The search results must be reported as a WEB PAGE, which should count the number of matches at the very top.
The Display all records menu will have an option for sorting based on the following fields:
The output will create a webpage which will then number and display all the sorted entries.
- name
- roll number
- department
- date of birth (chronologicall, see Date.java)
- userid, (98xxx is before Y02xxx)
- hostel (GH is after H8 and not before H1)
You can start the I/O part using this InputLab8.java as the input category. It also tests for month-of-year inconsistency by throwing a IllegalMonthException from the Date class defined in Date.java