# Algorithm Scan

Problem description:

In many of the colleges in India especially the South portion, students are asked to stay in hostels where food is provided along with accommodation. Students have to go to the dining halls to get the food. In case the students are not available to have food in hostels, they are generally asked to give a Reduction form (Paper work) so that they are not charged at the end of the month. It is a complex and longtime procedure to process the forms and is prone to a lot of human errors while processing.

In order to make this process simple, a program can be written so that students can simply scan their ID cards in systems and go away denoting that they will not be available for the day.

Algorithm formulation:

The following values may be necessary to make this algorithm work.

• 1 variable to scan and store student data
• 1 variable to collect the number of days/sessions the student will be absent
• A database which has all the student data of a college
• 1 variable to denote the number of units of food allocated for a month
• 1 file pointer

After data extraction is done from the student, it must be compared if the ID is in the database. If not, the system must stop execution. The number of chargeable units must be deducted by the number of days/sessions the student will be absent so that the student is not charged.

Algorithm:

Step 1:              Start Program

Step 2:              Get STUD_ID as input from Student ID card.

Step 3:              Open “Student_Dbs.xls” from memory using file pointer FP.

Step 4:              Extract Student details column from FP.

Step 5:              Start loop

i.      Check if STUD_ID is equal to ID_NO in FP

ii.      If yes, break look after extraction of UNIT_DETAILS

iii.      If no,  Increment ID_NO in database by 1 and continue to step (i)

Step 6:              Check to see if there is value in UNIT_DETAILS

Step 7:              If there is no value or default value, exit program displaying output “Wrong Details” and close FP. Else continue execution.

Step 8:              Ask Student to enter number of days/session of absence and stores in ABS.

Step 9:              Subtract the value of ABS in UNIT_DETAILS

Step 10:          Write the value of UNIT_DETAILS in “Student_Dbs.xls” using FP

Step 11:          Save “Student_Dbs.xls” and close FP

Step 12:          End Program

Program Extensions:

This program can be further extended so that by the end of the month, the total cost of food consumed can be calculated and a spread sheet can be made so that students can be charged accordingly. This can also be modifies so that the students can get data of the consumed units and available units for the moth when the appropriate options are chosen.

Algorithm tests:

Let us assume that the following table is the spread sheet for Student_Dbs.xls

 ID_NO STUDENT_NAME UNIT_DETAILS 09BAE12 Dharun K 31 09BEC14 Sowmya Y 28 09BCS56 Priya V 31 09BBT76 Shankaran D 25

Case 1:

STUD_ID = 09BCS56

The loop checks for the given data in ID_NO of “Student_Dbs.xls”

It goes to the 4th row and extracts UNIT_DETAILS data

It asks user to Enter number of days

ABS = 5

UNIT_DETAILS = UNIT_DETAILS – ABS

= 31-5   = 26

This is then saved to the “Student_Dbs.xls” file and the values are modified as follows

 ID_NO STUDENT_NAME UNIT_DETAILS 09BAE12 Dharun K 31 09BEC14 Sowmya Y 28 09BCS56 Priya V 26 09BBT76 Shankaran D 25

The file is saved and closed.

Case 2:

STUD_ID = 09BAE13

The loop continues and since at no instance ID_NO = STUD_ID the loops comes to an end.

Since ID_NO is not equal to STUD_ID, the error message of “Wrong Details” Appears and “Student_Dbs.xls” closes making no changes.

Conclusion:

Hence the above program can be used in most of the schools and colleges in India and other countries that follow the traditional technique. The above algorithm showed that the results produced were correct and program code can be written. Check out AceMyHomework.com for more!