Sie sind auf Seite 1von 98

Computer Science Coursework

Timetable Management System


Abhi Agarwal

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

Table of Contents
A1 Analyzing the problem............................................................................................................... 3 A2 Criteria for Success................................................................................................................... 10 A3 Prototyping.................................................................................................................................. 13 B1 Data structures........................................................................................................................... 27 B2 Algorithms ....................................................................... Error! Bookmark not defined. B3 Modular Organization ............................................................................................................. 35 C1 Good programming style................................................................................................. C1/54 C2 Handling errors .......................................................................................................................... 55 D1 Sample runs ............................................................................................................................... 63 D2 Evaluating Solutions ............................................................................................................... 92

Computer Science Coursework 2

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 A1 Analyzing the problem Details of the User: Name of the User: Anant Kothari Occupation: Student Graduation Year: 2012 School: Bangkok Patana School Email: anko12@patana.ac.th Website: http://anantko.posterous.com/ Subjects: Computer Science HL, Economics SL, Mathematics HL, English SL, French B SL, Physics HL, Further Mathematics SL, Physical Education, Theory of Knowledge, Extended Essay in Mathematics Anant Kothari is a student at Bangkok Patana School; he is currently in year 13, and does 9 subjects. Mr. Kothari has great potential but sometimes he is unable to cope up with his workload. Problem Outline and Analysis: A while back, I was talking to Mr. Anant Kothari and was discussing the problems we have as students in IB, and so I decided to suggest him to move to a more automated solution to manage his problems. Mr. Kothari currently uses a paper based solution and many manual computer solutions; he uses his whiteboard, his sticky notes, the school homework database and a simple notepad program on the computer. However, he is not satisfied with this solution and becomes very frustrated as it becomes very messy sometimes, and so I suggested to him to use a more automated based system, which will sort the timing and work a timetable for him on a daily or weekly basis. An important contact in order to fix this problem are his parents, and his cook; I have researched on my behalf to see who he spends most time with at home, I had seen that his cook and his parents decide mostly what he does, so in order to find out the solution to this problem I must contact his parents, Kiran Kothari, Anil Kothari and his cook. Below I have gathered information to create a basic daily routine on a school day for Anant, which I will further use for the solution as I will be generating his basic schedule and thus I have done the research to use in the solution ahead. One key example of where Anant has demonstrated that he requires this system is when he had not handed in three pieces of coursework over the course of one week on their respected deadlines, and this had caused Anant to increase his workload further on other days with other homework, and this caused his workload to overflow and he had to pile up and ask teachers to check his coursework on different deadlines. This happened on the week of the 27th of June 2011 and Anant and I both Computer Science Coursework 3

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 want to fix this problem by finding a solution of how he is able to efficiently able to manage his time and find the best possible way to do his work efficiently. Problem to be solved: A1 - Basic Daily Routine for School: Time 05:00 07:40 07:50 09:10 09:30 10:50 12:10 13:00 13:10 14:30 15:00 15:00 till finish After work 05:00 Routine Wake up in the morning for school Reach school in time for registration (with school bus) First lesson Break Second Lesson Third Lesson Lunch in school Registration Last Lesson On an average day, Anant leaves at school at 14:30 Reaches home Working on homework and/or playing games Sleeps

I have been having friendly talks with Mr. Kotharis and his main problem he tells me is time management; the user is not able to manage his time very effectively, as he misallocates his timings for sleeping, eating, working and having fun. He is sometimes unable to finish his work on some on some occasions, and plays games at random intervals when he should be working. Furthermore, he also watches too many lectures and podcasts, and this problem is very serious to him, and he would like to fix this time management issue as soon as possible. I had emailedi him on the 20th of June 2011 asking him what type of solution he would like, and he had replied back saying that he wanted a very simulated system, which would create him an advanced and detailed timetable of the day.

Computer Science Coursework 4

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Previous & current solutions: The current solution has various different problems, as I will outline in the table below: A2 - Sticky Notes [Electronically Post it notes](Figure 1) Advantage Organized manner to store information about homework Vibrant and colorful which attracts attention Limitless amounts of sticky notes can be created A3 - Whiteboard (Figure 2) Advantage User interactive so user wont usually forget about the task he/she needs to do Allows users to note take and collaborate Disadvantage Sometimes information can be accidently erased in that case the user would forget what they had put on there earlier The ink is sometimes expensive to buy and a regular use may be very costly to the user Usually fixed sized so we are not able to store more information than already on it. Disadvantage Sometimes simply ignore as they just display information but do not do anything Sometimes can be lost or misplaced on the computer as they are very small applications

A4 - Homework Database (Figure 3) Advantage Displays homework in a efficient manner with due dates and descriptions Has a very nice timetable with list of subjects Disadvantage Sometimes the user is unaware and does not take note of the other homework as the user feels that the teacher will put it on there, sometimes miscommunication occurs Sometimes causes stress as there is too much homework, it does not allow the individual to sort out and plan it just displays information about when its due.

Currently Mr. Kothari uses the sticky notes to store his work very non-specifically, he just puts it as shown in Figure 1 without any specifics and so if he forgets his specific homework then he will not be able to do it. He uses his whiteboard to solve his homework problems, and further sometimes do homework and put reminders of what to do on there.

Computer Science Coursework 5

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 The homework database, Mr. Kothari uses this to keep track of his homework on daily basis from the teachers, and puts a tick next to the homework when he has completed it. These are stored in his home as physical objects, and the bad thing is that he is not able to search the items in these things, he has to manually find if needs to search them. Typically, he has to use a pen in order to add a new record, and needs an eraser to delete it or modify it. Regarding the email, I saw how Mr. Kothari wanted to use the importance, estimated time of completion, and the total number of hours he wanted to spend to simulate the timetable of the day as a algorithm could sort out where the different works should be placed in ranking order, and then dedicated the time required and the breaks required that he will get, also accounting for dinner breaks and more that could be personalized by Mr. Kothari himself in the future. Previous solutions1 research also show that similar solutions have been used, however manual but also can be applied in the same scenario. Priorities have been set in previous examples, which have been set as importance plays a big role in this task, distractions are avoided as a perfect timetable to finish the work on time while also gaining enough sleep and free time is also considered, and lastly impossible situations are ignored as the solution will consider how much homework or data has been fed and what is possible to do. From the current solution we are able to take many of the features, such as the sticky notes and possibly create this type of note taking tool like sticky notes that could be implemented into this for the user to be more proactive in putting information and data onto this solution. The inputs within this program are the homework that has to be taken in for each subject, the number of minutes of relax time, and watching television and lectures per hour, the total number of hours able to work and specific details for each subject. For this request, I had created a simple understanding map of what the user had actually asked for and had copied it below.

A5 Sticky Notes, the user uses these electronically

http://www.marin.edu/~don/Study/5time.html Computer Science Coursework 6

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

A6 Whiteboard, which is used manually as a real life object

A7 Patana Online Homework Database http://www.patana.ac.th/Gateway/MyHomeworkLI2.asp - Username anko12

Computer Science Coursework 7

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

What homework do you have today? o Economics o Computer Science o Mathematics o English o French o Further Mathematics o Physics How long do you have to complete these tasks?
A8 - Adding homework

Specific Subject: Importance of task: Estimated time of completion: Description of homework:

This will be stored in the database, as the process. And the direct output will be a timetable that will show the basic outline of the day, from a fixed number of hours for school or a it could be used in the summer so there would be no school calendar, and it would show how much rest the body needs per hour of how much work they actually need to do after he is done with his work. It would also consider the amount of sleep required for the person, and this will be outputted in a timetable file that could be saved. Below is a dataflow diagram that could be used to describe the process that this solution will go through to generate this output for Mr. Kothari. A9 - Basic input stage one

The input that is got from the computer has these processes before the output

The computer asks him how long he wants to spend on each specific task,

Then the computer details for each specific task, asking him difficulty, how long he wants to spend on each task and what the homework actually is.

Computer Science Coursework 8

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 A10 - Basic output stage one

Proess: The data is stored in a database of many fields, with different day events and how much work he had done

Output Using Process It calculates the hardness level of the day according to the hardest day he has, hopefully by generating it into a number

FURTHER, it sorts it using an algorithm and checks how much Mr. Kothari wants to do work

Calculates, how much he wants to take breaks on that day, and naptime and then gives a simulation of what he should hypothetically do on that day.

In summary, these are the problems, which I have understood from Mr. Kothari: Move to a more automated solution to manage his problems, from a paper based solution Current solution is very messy, and sometimes gets very hard to use Unable to manage his time in order to finish all his work Not able to access all his information, the information is not portable, he is not able to take it to different places

In summary, these are the suggestions I have given Mr. Kothari in order to solve the problems that I have listed above: Simulate the timetable of the day, where: o The work will be ranked in order of importance o The time required and the breaks required will be calculated o Print the simulated timetable

Computer Science Coursework 9

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 A2 Criteria for Success The program that will be created for Mr. Kothari would include many features and would have to meet certain criteria. Creating an algorithm that simulates a timetable would have to have a perfect algorithm, or else the user is not able to complete his/her work at the right time. As in the analysis, the program needs to be able to: As required by analysis, the program must collect this relevant information from Mr. Kothari, therefore he will be able to (Figure 3): o Add, edit and delete the tasks and the different homework (in terms of subjects) o Add, and edit the description of tasks for every homework o Add, and edit the time required for each homework o Set and edit the priority of the tasks (in terms of importance) Allow free time and take consideration that Mr. Kothari might get distracted at some points, o Break given 15 minutes between every 2-4 activities Give the optimum sleep time required by the user, Create the same basic environment that Mr. Kothari currently uses, and provide a listing of the homework, Process, and calculates the information above and: o Add it into a database o Run an algorithm to: Sort and prioritize the homework into numbers Search the homework to calculate the total time required to do the homework and the time Mr. Kothari has after the school day and give Calculate an estimate of how long he needs for each homework, and store that into the database The output of this program will be: (Completes Table1) o The list of homework of the user (Figure 1) o Estimated time of completion o Simulated timetable of the day o Print the simulated timetable and the homework as stated in the analysis

The user controls: Who has access to the program o Add users to the database View users in the database

Computer Science Coursework 10

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

Security and Performance: Easy and simple to use for Mr. Kothari as it shouldnt take more than 5 minutes a day to put information into this program database, the program will use online processing as the processing done has to be fast and simple for the user to see and comprehend, and has to be static and be available to preview at all times The subjects will be auto generated and would not have to be set up by Mr. Kothari (As easy to add as with Figure 3) Mr. Kothari does not have to take back-ups himself in Windows Explorer, the program will be responsible to take daily or monthly backups for Mr. Kothari However a requirement could be to tell Mr. Kothari to take backs up incase of data loss. Has adequate error handling so if Mr. Kothari accidently puts in wrong information into the program, such as an extra digit when he is entering the number of hours, he is able to catch the error and throw it back or else: o There will be validation checks to check for this, the following will be implemented into the program: Presence check if he has actually put in the information required Length check if the information required is within the right range, such as the number of hours is in the correct number of digits the data will be processed Range check if the data lies within a correct range of subjects o As this will lead to Mr. Kothari being faced with errors and will disturb him from work. Moreover the simulation would also have errors. The program must be secure, so people arent able to tamper with the information, and Mr. Kothari is given a password and a username. Which allows him to login to the program. The program will be programmed for a multi user environment, so many people can use the program and as it can be used in Mr. Kotharis household. We have left it to Mr. Kotharis preference if he wants to use it as a multi-user or a single user program. Able to run on his Windows 7 Lenovo ThinkPad machine, however if needed will also be able to run on other computers, if Mr. Kothari decides to switch over to another platform: o Written in Java so it can run in different platforms, such as Macintosh while also running on Windows 7. o The program will be written for online processing, and not batch processing. The program will also be able to print the timetable, so Mr. Kothari will have to use the timetable on the machine, Mr. Kothari said that he need it to be able to print, but he is also happy to be able to keep the program open to preview his timetable. Computer Science Coursework 11

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Scope and Limitations: The predefined range of the homework will be 0-3 (or 15-180 minutes) hours, so Mr. Kothari wont be able to add homework, which is more than 3 hours long per one day. This program will be developed for a dual Mac and Windows system, and will be only able to save the files on, and not systems such as Linux. It will only handle a single user at a time; however, it will be created for a multiple user accounts environment. One user can use the program at one time from one computer. The program will not be able to generate and send mail messages into inboxs of other people or Mr. Kothari himself. The program will not be able to access any other files on the computer, such as address book, calculator, dictionary, spell check, files and pictures.

Computer Science Coursework 12

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 A3 Prototyping

A3 - Prototyping
In this section I will use Microsoft PowerPoint to create a prototype design for Mr. Kothari, and show it to him for feedback, and then I will adapt my design in regards to his feedback.

Time Management Simulator

Computer Science Coursework 13

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

Meet my client Mr. Anant Kothari


OHe is:
OUnable to manage time properly

OUnable to give in homework on time OUnable to revise properly OPlay games at random intervals and does not

work OWatches too much TED ONeeds a system for time management and simulator for a day

How does it work?


What homework do you have today? - Economics - Computer Science - Mathematics - English - Ab Initio Spanish - Physics How long do you have to complete these tasks?

Importance of task: Estimated time of completion: Description of homework:

Computer Science Coursework 14

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

Process of the input information


O The input that is got from the computer has these processes before the output: O There are many radio buttons asking what homework Mr. Kothari has for the day O The computer asks him how long he wants to spend on each specific task, O Then the computer details for each specific task, asking him difficulty, how long he wants

to spend on each task and what the homework actually is.

O The data is stored in a database of many fields, with different day events and how much

work he had done and calculates the hardness level of the day according to the hardest day he has, hopefully by generating it into a number
O FURTHER, it sorts it using an algorithm and checks how much Mr. Kothari wants to do

work and how much he wants to take breaks on that day, and naptime and then gives a simulation of what he should hypothetically do on that day.

Flowchart
TIME Table Simulation Login Linked List Add View Member Database

Homework Database

Print Remove Edit

Add Search View

Simulate

Output

Print

Computer Science Coursework 15

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management Tool (Prototype - Initial Design)

TIME MANAGEMENT TOOL

LOGIN: ANANT PASSWORD: * * * * * * * * * * LOGIN

Mr. Kothari: Change the password to a pin number system for ease numbers from 0 to 9

Computer Science Coursework 16

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

WELCOME YOUR IP ADDRESS: 193.192.192.1 YOUR EMAIL: ANKO12@ PATANA.AC.TH

ADD HOMEWORK EDIT HOMEWORK DELETE HOMEWORK VIEW HOMEWORK SEARCH HOMEWORK

Mr. Kothari: 1) Include a data column at the beginning and the user who logs in. 2) Include a file/ edit menu at the beginning.

- SIMULATE TIMETABLE - VIEW TIMETABLE

The TIME Management System


ADD HOMEWORK Subject:

Description of homework:

Mr. Kothari: 1) Add a dropdown menu for both: 1) Subject (The 7 school subjects) 2) Task Time (0-3 hours) In order to add homework faster and correct spelling.

Difficulty:

DROPDOWN
Task time:

ADD

Computer Science Coursework 17

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


EDIT HOMEWORK ID:

Mr. Kothari: This form seems fine.

DROPDOWN
SEARCH
Subject:

Description of homework:

Difficulty:

Task time:

EDIT

The TIME Management System


REMOVE HOMEWORK Subject:

Description of homework:

Mr. Kothari: 1) Add a dropdown menu for: 1) Subject (The 7 school subjects) 2) Task Time (0-3 hours) In order to easily choose the correct homework to delete.

Difficulty:

DROPDOWN
Task time:

DELETE

Computer Science Coursework 18

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


Search Homework Search In: Search: View Database

DROPDOWN
Subjects Physics Description Worksheet 5 Hard Difficulty

SEARCH
Time Taken 150

Mr. Kothari: 1) Create larger table, 2) Search to be as you type it, as key is pressed, so it is faster.

The TIME Management System


View Homework
Subjects Physics Mathematics Description Worksheet 5 Classwork Hard Easy Difficulty 150 20 Time Taken

Mr. Kothari: This form seems fine.

Computer Science Coursework 19

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


Simulate Timetable
School Break/ Nap Homework 1 Homework 2 Break Homework 3 Dinner Homework 4 Sleep time

Economics, Physics, Computer Science, Mathematics Length: 0.5 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy, Task time: 1 Subject: Physics, Description of homework: Do class worksheet, Difficulty: Hard, Task time: 2 Length: 0.5 Subject: Computer, Description of homework: Coursework, Difficulty: Medium, Task time: 1.5 Length: 1.0 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy, Task time: 1 Length: 8:00

7:45-2:30 2:30-3:00 3:00-4:00 4:00-6:00 6:00-6:30 6:30-8:00 8:00-9:00 9:10-10:10 10:10-6:00

Mr. Kothari: 1) Dont need to put the left menu, of School, Break/ Nap, incorporate it into the timetable itself, move the time on the right (7:45-2:30) and replace with the School menu. 2) Remove the Task time from the Homework's

The TIME Management System


View Timetable
School Break/ Nap Homework 1 Homework 2 Break Homework 3 Dinner Homework 4 Sleep time

Economics, Physics, Computer Science, Mathematics Length: 0.5 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy, Task time: 1 Subject: Physics, Description of homework: Do class worksheet, Difficulty: Hard, Task time: 2 Length: 0.5 Subject: Computer, Description of homework: Coursework, Difficulty: Medium, Task time: 1.5 Length: 1.0 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy, Task time: 1 Length: 8:00

7:45-2:30 2:30-3:00 3:00-4:00 4:00-6:00 6:00-6:30 6:30-8:00 8:00-9:00 9:10-10:10 10:10-6:00

Mr. Kothari (Same as Simulate): 1) Dont need to put the left menu, of School, Break/ Nap, incorporate it into the timetable itself, move the time on the right (7:45-2:30) and replace with the School menu. 2) Remove the Task time from the Homework's

Computer Science Coursework 20

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

Revised Goals: For Login: change the password to a pin number system for ease numbers from 0 to 9 For Logged in Menu: Include a data column at the beginning and the user who logs in and include a file/ edit menu at the beginning. For Add/ Remove Homework: Add a dropdown menu for Time taken, and Subject. For Search: Create larger table, and Search to be as you type it, as key is pressed, so it is faster. For Simulate/ View Timetable: Replace time menu on the right to the School menu on the left, and remove the time tasks take from the Description of Homeworks.

The TIME Management Tool (Changed with user feedback)

Computer Science Coursework 21

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

TIME MANAGEMENT TOOL

LOGIN: ANANT PASSWORD 1 4 7 2 5 8 0 LOGIN 3 6 9

File Edit Print


WELCOME MR. ANANT KOTHARI YOUR IP ADDRESS: 193.192.192.1 YOUR EMAIL: ANKO12@ PATANA.AC.TH DATE: TUESDAY 21 ST OF JUNE 2011

ADD HOMEWORK EDIT HOMEWORK DELETE HOMEWORK VIEW HOMEWORK SEARCH HOMEWORK

- SIMULATE TIMETABLE - VIEW TIMETABLE

Computer Science Coursework 22

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


ADD HOMEWORK Subject:

DROPDOWN
Description of homework:

Difficulty:

DROPDOWN
Task time:

DROPDOWN
ADD

The TIME Management System


REMOVE HOMEWORK Subject:

DROPDOWN
Description of homework:

Difficulty:

DROPDOWN
Task time:

DROPDOWN
DELETE

Computer Science Coursework 23

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


EDIT HOMEWORK ID:

DROPDOWN
SEARCH
Subject:

Description of homework:

Difficulty:

Task time:

EDIT

The TIME Management System


Search In: Search: Search Homework View Database

DROPDOWN
Subjects Physics Description Worksheet 5 Hard Difficulty

RESET
Time Taken 150

Computer Science Coursework 24

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


View Homework View Database
Subjects Physics Mathematics Description Worksheet 5 Classwork Hard Easy Difficulty 150 20 Time Taken

The TIME Management System


Simulate Timetable
7:45-2:30 2:30-3:00 3:00-4:00 4:00-6:00 6:00-6:30 6:30-8:00 8:00-9:00 9:10-10:10 10:10-6:00 Economics, Physics, Computer Science, Mathematics Length: 0.5 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy Subject: Physics, Description of homework: Do class worksheet, Difficulty: Hard Length: 0.5 Subject: Computer, Description of homework: Coursework, Difficulty: Medium Length: 1.0 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy Length: 8:00

Computer Science Coursework 25

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The TIME Management System


View Timetable
7:45-2:30 2:30-3:00 3:00-4:00 4:00-6:00 6:00-6:30 6:30-8:00 8:00-9:00 9:10-10:10 10:10-6:00 Economics, Physics, Computer Science, Mathematics Length: 0.5 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy Subject: Physics, Description of homework: Do class worksheet, Difficulty: Hard Length: 0.5 Subject: Computer, Description of homework: Coursework, Difficulty: Medium Length: 1.0 Subject: Economics, Description of homework: Do class worksheet, Difficulty: Easy Length: 8:00

Overall Goals For Login: change the password to a pin number system for ease numbers from 0 to 9 For Logged in Menu: Include a data column at the beginning and the user who logs in and include a file/ edit menu at the beginning. For Add/ Remove Homework: Add a dropdown menu for Time taken, and Subject. For Search: Create larger table, and Search to be as you type it, as key is pressed, so it is faster. For Simulate/ View Timetable: Replace time menu on the right to the School menu on the left, and remove the time tasks take from the Description of Homeworks.

Check

Computer Science Coursework 26

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 B1 Data structures In this section I will outline the different data structures that will be used for the data access and storage, data processing in the RAM, implementation of arrays and linked lists, and the mastery factors I will consider in my solution. The solution will consist of two binary files to save the data into; the data will be stored in a random access binary file. I will use one binary file for the one for the personal details, one for the homework database. I have chosen to use binary files rather than text files because the reading and writing to data as it is faster and the memory is more efficiently stored. It also ensures that the data isnt altered. I choose random access because, a lot of data will be stored about this timetable and it is easier and faster to access each record, and moreover the files can be read and written to at the same time. I will add or delete elements to a linked list for the program I have created. In this section I will demonstrate the techniques I will use for adding and deleting elements. The data will be sorted in ID and does not necessarily have to be sorted alphabetically in any way. There are many things I need to store in the RAM when the program is running, and there are also variables that I need stored into external files. I will use binary files to store my data into. For random access files, the records must be of a fixed length, this could mean that there would be wasted space if there are blanks or if the space allocated to them isnt fully used, however, I will use validation checks to make sure this doesnt happen. Firstly, I will list the different tables I will use in my program, and explain why I will use the random access binary file, and then secondly I will explain the data processing that goes on in the RAM. Data files The personal details of the user, which is Mr. Kothari, will be saved in the first random access binary file: Member Details:
Field Name UserID Username Password Subject1 Subject2 Subject3 Subject4 Subject5 Subject6 Subject7 Deleted Field type int String int String String String String String String String int Field Size (characters) 3 10 20 19 19 19 19 19 19 19 1 Field Size (bytes) 12 20 80 38 38 38 38 38 38 38 4 Example Data 1 Anant 12345abc Computer Science Physics Economics Mathematics English French Further Mathematics 0 not deleted Description This is a unique key field Username for login for the solution Password for the login 1 subject 2 subject 3 subject 4 subject 5 subject 6 subject 7 subject Deleted or not
th th th th rd nd st

Computer Science Coursework 27

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 The length of the Member details is 382 in bytes, and 167 characters. I will not include the first name, last name, number of subjects because these are static in High School. Mr. Kothari wanted this solution for time management in high school. However to increase the flexibility of this solution I am also including the different subjects which allow him to potentially use it in the future, and change his subjects to suit his future needs, or for him to give this solution to his friends in the future. Furthermore, I choose the field size of UserID to be only 4 bytes because this is Mr. Kotharis personal program and he will not be adding many users, it is easier to save memory. This shows a hierarchy diagram for the interaction of the data for the member details:

Any record will be able to accessed randomly because the file pointer seeks the position of the record directly and multiplies the record number by 167 characters to be able to access the data, as the data will be like this:

Therefore, it will skip through the first 382 bytes, or 167 characters if we assume that it is searching for the second record.

Computer Science Coursework 28

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Homework database: When Mr. Kothari enters the homework into the program, this homework will be saved so he is able to review it later, and this homework will be saved in the second random access binary file:
Field Name HomeworkID Subject Deschome Field type int String String Field Size (characters) 5 20 500 Field Size (bytes) 20 40 1000 Example Data 00001 Economics Sheet given in class Description This is a unique key field The subject the homework has been entered for The description of the homework, 500 is so the user has enough words to write about the homework Hard medium or easy How long Mr. Kothari has to spend on the homework

Difficulty Timetaken

String int

6 3

12 12

Medium 30

This is 538 characters, or 1084 bytes, but using the RandomAccessFile class we are able to skip 538 characters to find the second record. Data processing in the RAM: When the program has been executed, the Homework_database records will be read into the RAM, the records will be stored in a link list data structure. The data records will be read into memory as objects of data type these records. Initially I wanted to save them as partially indexed files to store the Homework, however I felt I could create a new binary file to read on a daily basis. This would allow him to not waste time deleting previous homework, but also allow him to go back and check his previous timetables, and would save time if the big file becomes corrupt in the future. And if we limit the homework to being 12 homeworks a day, then we dont require a partially indexed file, but we can use a random access file for this solution too. I propose to use a random access binary file, and then importing the data from that file into a linked list, in objects of Homework_database, which can be then read. I chose a linked list for the object Homework_database for numerous reasons. Linked lists are dynamic data structures, and thus the size of the linked list is variable, and against arrays it is not fixed, and does not need to be specified before the execution of the program by the user. It also is very easy to add or delete elements from anywhere into any place in the linked list, the program only needs to allow the pointers to move. Linked links are efficient in memory storage; they do not need spaces to store something in memory, unlike arrays, which are static data structures. They only hold the address of the next node in memory, and so dont require containing spaces. On the other hand, linked lists only use sequential access and the memory space that is used to store the address for the next record is wasted. This Computer Science Coursework 29

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 will also allow me to sort the file easily, either by directly sorting it in the linked list or copying the data into a array and sorting the array using an quicksort algorithm. To put it back into context of the Homework_database this will make it easier to add or remove homework, while it also allows to store this data efficiently, and Mr. Kothari is able to navigate through the different records easily. Below I will show an example of a linked list of the object Homework_database, to make it easier to display I will use the ID.

Computer Science Coursework 30

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Now I will show an example of a linked list where I will remove data from the file: This is the linked list before deleting the data:

Now, I will have two types of data, I will have active data and deleted data, active data will be data which is kept by the user and has not been deleted. While the deleted data is data that has been deleted by the user, however I will still be keeping this data in the database so Mr. Kothari will be able to reference it and use it in the future. For example, if the 3rd record had been deleted this is would it would look

Therefore, the new table would be:


Field Name HomeworkID Subject Deschome Field type int String String Field Size (characters) 5 17 500 Field Size (bytes) 20 34 1000 Example Data 00001 Economics Sheet given in class Description This is a unique key field The subject the homework has been entered for The description of the homework, 500 is so the user has enough words to write about the homework Hard medium or easy How long Mr. Kothari has to spend on the homework If the record has been deleted (1) or if it is active (0)

Difficulty Timetaken Delete

String float int

6 3 1

12 12 4

Medium 2.5 1

This will allow us to not only go through the data but also preview it later, however, taking into consideration the space required to store this data, it is not a problem as the hard disk space stored in Mr. Kotharis desktop is over 600 Gigabytes. Computer Science Coursework 31

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 The records of the second and last binary file Member_details will be read into the RAM, and held in an array data structure. I chose this data structure because of it does not require much changing, and Mr. Kothari wont be making regular additions or subtractions from this data, it will be kept often static. It is also easy to use and implement for both the user and the programmer, as the output shown to the user is easy to read. I will be writing the Array into a Random Access Binary File, and then when the program starts up I will be reading it from the file and putting into the array. This will allow me to save the data and search through the data. A diagram is shown below of an array with the member files, 2 data entries are present:

1
Member_details[0] Settings:

2
Member_details[1]

When simulating the timetable, Mr. Kothari requires to put in a time where he will start his studies, this setting will be saved so it can be referenced later, and this setting will be saved in a text file:
Field Name Time Field type String Field Size (characters) 5 Field Size (bytes) 10 Example Data 10:00 Description This is the time when the simulation starts.

This is a text file, so it will be using BufferedWriter and a BufferedReader, and using the FileWriter we can save it in the same location as the other files. This will be unique for all different users or for Mr. Kothari if it is a single user.

Computer Science Coursework 32

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Mastery Factors I will use using several concepts in this solution, as mastery factors in order to demonstrate and fulfill the requirements set by the user. Here is a list of the mastery factors I will be using in this solution: I will be firstly considering 15 Standard level Mastery factors: Mastery Factor 1. Arrays 2. Simple Selection Description I will be using arrays in my Member_details binary file, which is read into RAM. I will using if and else statements in my Homework_details and adding the homework to the link lists. I will be using loops to enter information into arrays and different data members. I will be using nested loops to display the array contents to the user I will be using user-defined methods in the program. I will be using nested if statements and if with multiple conditions for validation checks. Sorting data with subject to enter into the linked list Searching through information in the binary file or the linked list. Homework_database object, and Member_details object Instance of Homework_database and Member_details object used in the program, to sort, search ect. For adding/removing homework algorithms, and sorting

3. Loops 4. Nested Loops 5. User-defined methods 6. Complex selection 7. Sorting 8. Searching 9. User-defined objects 10. Objects as data records 11. User defined methods with parameters 12. User defined methods with appropriate return values 13. File i/o 14. Use of additional libraries 15. Use of sentinels or flags

Quicksort

Saving and reading the Random Access File To create tables, or graphics To flag the delete in homework or user (0 not deleted and 1 deleted)

Computer Science Coursework 33

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Now, I will use 14 Higher-level Mastery factors in this solution: Mastery Factor 1. Adding data to an instance of the RandomAccessFile class by direct manipulation of the file pointer using the seek method 2. Deleting data from an instance of the RandomAccessFile class by direct manipulation of the file pointer using the seek method 3. Searching for data in a file 4. Recursion 5 - 8. Abstract Data Structure 1 Linked List 9. Use of additional libraries Description Adding data to my Random Access binary file by using the seek method.

Deleting data from my random access binary file using the seek method.

10. Implementing a hierarchical composite data structure.

11. Encapsulation

12. Standard level mastery factors 13. Arrays of two or more dimensions 14. Inheritance

Searching the homework and the timetables. For my sorting function used for my timetable Implementing a linked list for my Homework_database. I will be using graphical libraries in my solution, which I will implement throughout the program (provided by Java). I will be storing my Member_details within an array inside an array for the member details. And in my linked list I will be storing 2 records, one for the ID and one for the Status for Homework_database. I will make the fields in my class private and provide access to them via constructors and mutator. I have listed the mastery factors Ive used in standard level above. To create a static form for View Homework. To inherit the tables function from a super class

In total I will be claiming 15 standard level mastery factors, and 13 higher-level mastery factors. As the Abstract Data structure counts towards 4 higher-level mastery factors. In total I have 14 higher-level mastery factors, as having 15 standard level mastery factors is 1 higher-level mastery factors.

Computer Science Coursework 34

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 B2 Algorithms This section in my solution is about algorithms; algorithms are methods that execute to solve different problems and output solutions. In this section I will consider the different types of algorithms I will be using in my program I will be building in the future. I will consider them for my linked list, my array and many other different solutions I will require. Firstly, I will consider arrays: In my array I will have an object within the array with the different fields for the member details records. For example my array would be: Name ID [0] Name ID [1] Name ID [2]

In this I will use different codes to insert information into, such as: Inserting Deleting Edit

The definition of the class with the Member_details would be: int UserID; String username; int password; String Subject1; String Subject2; String Subject3; String Subject4; String Subject5; String Subject6; String Subject7; int Delete; To be able to use these functions we will need accessor and mutator methods, which we will use in the solution, for example: setID(int ID) setUsername(String user) setPassword(int Password) setSubject1(String Subject1) setSubject2(String Subject2) setSubject3(String Subject3) setSubject4(String Subject4) Computer Science Coursework 35

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 setSubject5(String Subject5) setSubject6(String Subject6) setSubject7(String Subject7) setDelete(int Delete) getID() getUsername() getPassword() getSubject1() getSubject2() getSubject3() getSubject4() getSubject5() getSubject6() getSubject7() getDelete()

Computer Science Coursework 36

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

1. AddtoArray() function
I will be able to input this information into my array in order to insert the data into the array. Parameters Passed in Parameters Passed out UserID, username, No return (void) password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7, delete Psuedocode Public void AddtoArray (String username, int password, String Subject1, String Subject2, String Subject3, String Subject4, String Subject5, String Subject6, String Subject7, int delete) Int Arraylength = the length of the array If the (Arraylength < 5) Array[Arraylength+1).UserID = Arraylength+1 Array[Arraylength+1).username = username Array[Arraylength+1).password = password Array[Arraylength+1).Subject1 = Subject1 Array[Arraylength+1).Subject2 = Subject2 Array[Arraylength+1).Subject3 = Subject3 Array[Arraylength+1).Subject4 = Subject4 Array[Arraylength+1).Subject5 = Subject5 Array[Arraylength+1).Subject6 = Subject6 Array[Arraylength+1).Subject7 = Subject7 If not then (Output(Array size full)) Output User with [username] has been added! Inputs Outputs Possible tests Username, Password, User has been added! To attempt to add a user and the 7 subjects taken to the array by the user. Preconditions Postconditions The size of the array has not been No postconditions surpassed, currently Mr. Kothari wishes it to be maximum of 5 members in the database. So arraylength > 5 Variables used Arraylength, raf, ID, username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7, delete

Computer Science Coursework 37

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

2. WriteArray() function
I will be able to write this information into a random access file in order to read it after the program has been ran for the second time. Parameters Passed in int ID, Member_details user Parameters Passed out No return (void) Variables used ID, Member_details, username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7, delete, usernamearray, subject1array, subject2array, subject3array, subject4array, subject5array, subject6array, subject7array

Psuedocode Public void WriteArray (int ID, Member_details user) Convert username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7 into arrays Buffer spaces into username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7 Seek to the end of the file using Random Access File Write username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7 Inputs No inputs by the user Outputs No output Possible tests To attempt to write the array to the random access file Postconditions No postconditions

Preconditions The size of the array has not been surpassed, currently Mr. Kothari wishes it to be maximum of 5 members in the database. So arraylength > 5

Computer Science Coursework 38

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

3. ReadArray() function
I will be able to write this information into a random access file in order to read it after the program has been ran for the second time. Parameters Passed in int value Parameters Passed out Member_details Variables used ID, Member_details, username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7, delete,

Psuedocode Public static Member_details ReadArray (int value) Seek to a particular value (value*167) Instantiate an object Save ID, Member_details, username, password, Subject1, Subject2, Subject3, Subject4, Subject5, Subject6, Subject7, delete into the object Save the information into the Array Return the object Inputs No inputs by the user Outputs No output Possible tests To attempt to read the users from the database Postconditions No postconditions

Preconditions The size of the array has not been surpassed, currently Mr. Kothari wishes it to be maximum of 5 members in the database. So arraylength > 5

Computer Science Coursework 39

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

The main object for the linked list and the Random Access File
For example, for the Homework_database this would be the class: class Homework public int HomeworkID public String Subject public String Deschome public String Difficulty public float Timetaken private Homework next ( For the linked list ) Furthermore, so the function is able to add and delete things into the linked list we require a constructor that sets things to null: public Homework() HomeworkID = null Subject = null Deschome = null Difficulty = null TimeTaken = null Now, we require a constructor that adds things to the linked list: public Homework(ID, sub, Desc, Diff, Time) setID(ID) setSub(sub) setDesc(Desc) setDiff(Diff) setTime(Time) To be able to use these functions we will need accessor and mutator methods, which we will use in the solution, for example: setID(int ID) setSub(String sub) setDesc(String Desc) setDiff(String Diff) setTime(int Time) getID() getSub() getDesc() getDiff() getTime()

Computer Science Coursework 40

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

4. WritetoHWRAF() function
I will be able to write and append this information into my random access file. Parameters Passed in Homework_database data Parameters Passed out No return (void) Variables used Homework_database, List_Homework_database, subjectarray, descarray, difficultyarray, subject, desc, difficulty, raf

Psuedocode Public void addtoHWRAF (Homework_database data) Convert subject, desc, difficulty into arrays (From Homework_database object) Buffer spaces into subject, desc, difficulty Seek to the end of the file using Random Access File Write ID, subject, desc, difficulty, time, delete Output Homework added! Inputs N/a Outputs Homework added! Possible tests To add data to the database Postconditions No postconditions

Preconditions The file must exist, or the program will create the new file.

5. ReadfromHWRAF() function
I will be able to read the information into my linked list and into the fields from the random access file. Parameters Passed in int value Parameters Passed out Homework_database Variables used Homework_database, List_Homework_database, raf, subject, ID, desc, diff, time, delete

Psuedocode Public static Homework_database ReadfromHWRAF (int value) Seek to a particular value (value*538) Instantiate an object Save subject, desc, diff, time, delete into the object Save the information into the Linked List Return the object

Computer Science Coursework 41

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Inputs Value of where to seek it from the user Outputs N/A Possible tests To attempt to read the information from the database. Postconditions The object is returned.

Preconditions The file must exist in order to read it.

6. EditHWRAF() function
I will be able to edit the information from the random access file in through this function. Parameters Passed in int ID, String Subject, String desc, String difficulty, int time, int delete, int value Psuedocode Public static void edit (int ID, String Subject, String desc, String difficulty, int time, int delete, int value) Seek to a particular value (value*538) Instantiate an object Save subject, desc, diff, time, delete into the object at that particular spot Save the information into the Linked List Return the object Inputs Subject, description, difficulty, time Outputs N/A Possible tests To attempt to read the information from the database from a particular spot and editing it Postconditions No postconditions Parameters Passed out No return (void) Variables used Homework_database, List_Homework_database, subjectarray, descrarray, difficultyarray, subject, desc, diff, time, delete

Preconditions The file must exist in order to read it. Now, I will consider linked lists:

In my linked lists I will store information and I will require 3 different functions to add to my linked lists, I will have one linked lists in my solution, for the Homework_database. The methods I will implement in my linked lists are listed as the following: Add Computer Science Coursework 42

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 Display Size isEmpty

7. AddLinkedList() function
This function would add to the end of the Linked List Parameters Passed in ID, Subject, Desc, Diff, Time Psuedocode Parameters Passed out Nothing Variables used Nothing

Public void AddLinkedList(ID, Sub) Homework HNode = new Homework(ID, Subject, Desc, Diff, Time) root = HNode Inputs Outputs The details of the No output homework to became the object Preconditions No preconditions Possible tests Check if the homework is added to the LinkedList Postconditions No postconditions

8. DisplayLinkedList() function
The Display function displays the contents within the Linked List. Parameters Passed in Nothing Psuedocode Parameters Passed out Nothing Variables used Nothing

Public void DisplayLinkedList() Create variable - Homework temp temp = root while(temp does not equal null) Output UserID + temp.getHomeworkID() Output UserID + temp.getSubjects() Output UserID + temp.getDesc() Output UserID + temp.getDifficulty() Output UserID + temp.getTimetaken() Inputs Outputs None No output

Possible tests Check if all the contents of the Linked lists are Computer Science Coursework 43

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 displayed Postconditions No postconditions

Preconditions No preconditions

9. SizeLinkedList() function
The Size function returns the size of the Linked List. Parameters Passed in Parameters Passed out Nothing int Psuedocode Importing Java Utilities for Linked Lists Public int SizeLinkedList() int size = Homework.size return size Inputs None Preconditions No preconditions Outputs Size Possible tests Check the size Postconditions No postconditions Variables used Nothing

10. isEmpty() function


The isEmpty function checks if the Linked List is empty or full. Parameters Passed in Nothing Psuedocode Parameters Passed out Boolean Variables used Nothing

Public boolean isEmptyLinkedList() return if Homework.next equals null Inputs None Outputs True/false Possible tests Put an empty array and see if this responds to it being empty, and do vice versa. Postconditions No postconditions

Preconditions No preconditions

Computer Science Coursework 44

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004

11. SimulateTimetable() function


The SimulateTimetable function simulates a timetable using the Homework_database and the random access binary file. Parameters Passed in Nothing Parameters Passed out Nothing Variables used LinkedList List, Homework_database[] Array1, Homework_database[] Array2

Pseudocode Public void SimulateTimetable() Read the data from the Random Access File into the List Load the List Convert the List into an Array1 Sort the Array1 using Quick Sort and return as Array2 Add records to the Table in ascending order adding of Time Taken by doing this: Add the time to the hour if its divisible by 60 If it is less than 60 then add it to the minutes If it is more than 60 and less than 120, add 1 to the hour and Time Taken 60 to the minutes If it is less than 180 but more than 120, add 2 to the hour and Time Taken 120 to the minutes Output Estimated Time of Completion Every 2 new records added add a break 15 minutes and increase the current time of minutes by 15 minutes, if the minutes become 60 then add 1 to the hour and make the minutes 00. Inputs Outputs Possible tests None Simulated Timetable in Try to generate a jTable form timetable. Preconditions Postconditions The Linked List is not empty No postconditions

Computer Science Coursework 45

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 B3 Modular Organization In this section I will break down my program into different modules and subcomponents of the program I will be making. I will break them down into three main modules, the data structure of the program, the file-access functionalities of this program, and the process and functions within the program. I will have different classes within my program and use different data members within those classes, but the main class I will be using within my program will be the Homework_datetimecheck class, this will claim the locations of the files for the other main classes for the different main sections of the program. The Homework_database class and the Member_details class, they both have their own main purposes, one is an object required to store homework into the random access binary file, and the other is an object to store members in order to read and write to a random access file. The Timetable_main_RWRAF class will contain the functions required to add, edit, and delete records from the random access file itself. The class Homework_datetimecheck wont be instantiated within the program, however will contain all the code to interact with the user, the main part of the program will be executed here, and then will reference and call different functions from different classes. It will contain the date, time, and the location of the file. The class Member_details_add will contain the functions and methods for the user to be able to login to the program, it will read information as objects from the class Member_details. The class Member_details_add will act as if it is a private class, this will just store the details of the users and their passwords as objects in the random access file. The class Member_details_add will also have functions to add, and view users, which will be called AddUser, ViewUsers. The class Member_details_add will retrieve the information from the random access file in form of the object Member_details and will access it by using different mutator methods and accessor methods. The accessor will retrieve the information for the username and password and return this value, and possibly logging that the information has been read from a user. And the mutator will be able to edit or change the information within the array as changed by the user in the program. The classes: Homework_database_add, login_area, administration, Login_form, Homework_database_edit, Homework_database_remove, Homework_database_view will take input from users and have a Graphical User Interface. These classes for the Homework_database_ will be programmed for their homework and difficulty as explained before and with the date it will save it into a random access binary file, this random access binary file will be specifically to save Homework, and this homework will also be passed into the class: Stimulated_timetable_database_simulate where it will be processed and a timetable will be generated and displayed upon the screen. Computer Science Coursework 46

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 The function to save it to a random access binary file will be in the Timetable_main_RWRAF class and the different classes will be able to call this function to be used in the different classes. The function will be called Timetable_main_RWRAF.write. There will also be a function in Timetable_main_RWRAF to Timetable_main_RWRAF.read, Timetable_main_RWRAF.edit and Timetable_main_RWRAF.delete this information. Top-down hierarchical model M1 - For different classes and relationships Below is the relationship between the two classes; the class Homework_datetimecheck will consider the location of random access files of the member functions and methods from the class. The two classes below are the objects that are used in the process of the program itself.

Homework_datet imecheck

Homework_Data base

Member_Login

Below is the relationship between the flow through the classes as the program moves from logging into the program via the Member_details_add class to the user entering the information for the homework in Homework_Database. These are the classes that the program goes through that read data from files the random access files, and in the order they write them in. Timetable_main_RWA RF

Homework_datetimecheck

Member_details_add

Computer Science Coursework 47

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 M2 - Functions and methods of the classes

Homework_datetimecheck - Checks the location of the settings file - Checks location of the member file - Checks location of the homework file - Check location of the directory - Sets the Member_loggedin - Reads the settings required by the user

Homework_main_R WRAF - Add, edit, delete, view, search homework - Convert into format that will be able to process with Stimulated timetable Database

Member_details_add - Add, view users - Authenticate users

Read from the random access file

Read and write to a Random access binary file

List_Homework_data base - Add, edit, view, delete homework

Read and write to a Random access binary file

Member_details_add - Save the users in an Array and read it from a random access binary file

Write into the random access file

Computer Science Coursework 48

Computer Science Coursework Abhi Agarwal Candidate Number: 000765 - 004 M3 Classes, methods and functions linked together

This class sets the time, date for the program itself. This class also contains and sorts for the location of the random access files according to the Mac or Windows choice of the user.

The File I/O system controls the input of the random access file into the program and then outputs the random access file when the user alters or adds something to the database. The administration is where the user can access the add, and view members functions.

These are the functions for the RWRAF adding, editing, deleting, viewing and searching the homework.

Computer Science Coursework 49

Computer Science Coursework Abhi Agarwal M4 - Startup Mac/ Windows questions This module contains no menu choices, but the user has to enter either Macintosh or Windows and enter the data in order to get to the Login module. Called from 1. Start of the program Links to 1. Login module

M5 - Login module: This module contains no menu choices, but the user has to enter the correction information for it to grant access to the Logged in page. Called from 1. Startup Mac/Windows questions Links to 1. Logged in 2. Homework_datetimecheck

M6 - Logged in module: This module contains 9 menu choices from where the user chooses what to proceed to from after logged into the database. Called from 1. Login_form module Links to 1. Add Homework 2. Edit Homework 3. Delete Homework 4. View Homework 5. Search Homework 6. Administration a. Add User b. View User 7. Simulate Timetable 8. View Timetable 9. Print homework and timetable

Computer Science Coursework 50

Computer Science Coursework Abhi Agarwal M7 - Add Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Homework_main_RWRAF.add function 2. Homework_datetimecheck 3. Add to Linked List

M8 - Edit Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Homework_main_RWRAF.edit function 2. Homework_datetimecheck 3. Edit from Linked List

M9 - Delete Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Homework_main_RWRAF.delete function 2. Homework_datetimecheck 3. Delete from Linked List

M10 - View Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Homework_main_RWRAF.view function 2. Homework_datetimecheck 3. View Linked List

Computer Science Coursework 51

Computer Science Coursework Abhi Agarwal M11 - Search Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. RWRAF Search function 2. Homework_datetimecheck 3. Search Linked List

M12 Administration module: This module consists of two choices to continue, either the Add Member module or the View Member module. Called from 1. Login module Links to 1. Add Member 2. View Member

M13 - Add Member module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Administration module Links to 1. Member_details_add.write function 2. Homework_datetimecheck

M14 - View Member module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Administration module Links to 1. Member_details_add.read function 2. Homework_datetimecheck

M15 Simulate Timetable module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Simulated_timetable_database_simulate 2. View Timetable 3. Homework_datetimecheck

Computer Science Coursework 52

Computer Science Coursework Abhi Agarwal M16 View Timetable module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module 2. Simulate Timetable Links to 1. Simulated_timetable_database_simulate 2. Homework_datetimecheck

M16 Print Timetable and Homework module: This module consists of no menu choices from where the user chooses but the user has to submit the information in order to continue. Called from 1. Login module Links to 1. Print_homework 2. Print_timetable 3. Homework_datetimecheck

Computer Science Coursework 53

Computer Science Coursework Abhi Agarwal

Computer Science Coursework 54

Computer Science Coursework Abhi Agarwal C2 Handling errors Software errors System software errors Software errors are a type of run-time error, these errors arise when the program is running and the software resource is missing or not available. Error # How to handle error Consultation

E1 Add Homework, Edit Homework, Delete Homework, View Homework, Print Homework, Search Homework, Simulate Timetable, Add Member, Read settings If the file does not exist: E2 Login Form Member file not found Presence check

In the RWRAF class, the file is automatically created if it is not present, but also throws an catch error when the code has been tried: } catch (FileNotFoundException e) { e.printStackTrace();

If the Homework file is not present it is created, the user is not notified that the file does not exist. Even if the user has entered nothing into the Homework file it has still been created in the static directory. The computer will be able to solve this error without user intervention. And this error does not need to be informed to the user, as the program will fix it itself. Opens a new form that creates the Member File, and takes the input of the user in his/her subjects, username and password. It will only execute the form if the file exists: if (fexists) { try { } and if it doesnt exist the form will create a new Member Details file with a new member selected by the user. The computer will be able to solve this error without user intervention. And this error does not need to be informed to the user, as the program will fix it itself.

public Login_form() { checkfile(); } public static void checkfile() { File file = new File("/Users/MDatabase.dat"); boolean fexists = file.exists();

if (!fexists) { new add_new_user().setVisible(true); } }

Computer Science Coursework 55

Computer Science Coursework Abhi Agarwal System hardware errors Error # How to handle error Consultation

E3 Login Form Not enough memory left.

public void checkspaceleft() { File file2 = new File("/Users/"); if(file2.getUsableSpace()<1000) { JOptionPane.showMessageDialog(null,"Please increase the amount of memory in your hard disk in order for this program to function.", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); this.dispose(); } }

If the amount of space left for the program is getting smaller in the hard disk, then the program will notify the user to increase the space on his/her hard disk and restart the program. The program will then close. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error.

Data-Entry errors This error is mainly generated due to entering data that is not the correct type of data required for a particular field. User Data-Entry errors Error #
E4 Login Form If username and password match to the ones in the database.

How to handle error


if(default1.getUsername().equalsIgnoreCase(username) && default1.getPassword().equals(pass)) { existornot = true; } if(existornot == false) { JOptionPane.showMessageDialog(null,"Username or Password not found!", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); numberofpins = 0; UsernameF1.setText(""); jLabel2.setText(Integer.toString(numberofpins)); }

Consultation
The output is Username or Password not found!, the user has to reenter the username and password correctly to proceed. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error.

E5 Add Homework

if(descchosen.length() < 501) { code else

The user has to reenter the description to fit the size limit, if the size is exceeded

Computer Science Coursework 56

Computer Science Coursework Abhi Agarwal


If the size of the description isnt greater than 500 Length Check { JOptionPane.showMessageDialog(null,"Your description is too big, please cut it to 500 words", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); } the output is Your description is too big, please cut it to 500 words. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error. The user has to reenter the description to fit the size limit, if the size is exceeded the output is Your description is too big, please cut it to 500 words. This will be a validation check as it will be checking length. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error. These functions implement this in order to differentiate between the deleted and the non-deleted fields. However, even deleted homework can be edited, as it can also be undeleted if it is required to. The computer will not be able to solve this error without user

E6 Edit Homework If the size of the description isnt greater than 500 Length Check

if(desc.length() < 501) { code else { JOptionPane.showMessageDialog(null,"Your description is too big, please cut it to 500 words", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); }

E7 Edit Homework, View Homework, Remove Homework If there is no next record E8 View Homework, Remove Homework, Check deleted Records Presence Check

As it would be inconvenient to add more DialogBoxes every time the user reaches the end of the number of records there are, there is no return to the user that he/she has reached the end of the file. This has been implemented, as it would be obvious to the user that there are no records if the next record does not load, and would irritate the user if too many pop-up boxes are implemented. I have also created last record buttons in order for the user to skip to the last record, or first record buttons for the user to skip to the last record. The program automatically checks for deleted records: if (Timetable_main_RWRAF.checkDelete() == 0) { .. code }

Computer Science Coursework 57

Computer Science Coursework Abhi Agarwal


intervention. And this error does need to be informed to the user, so the user can fix the error. The user will be told to enter all information again, and the user has to fill in all the data. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, as the program will not fix it itself.

E9 Member Add Check to see the required fields are filled in, validation. Presence check

if(Username != null && Password != null && Subject1 != null && Subject2 != null && Subject3 != null && Subject5 != null && Subject6 != null && Subject7 != null) { code }

else { JOptionPane.showMessageDialog(null,"Please enter all the information required", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); } E10 Read Settings Checks if the time that is inputted into the write function is not null public static void write(String time){ if(time != null) { code else { JOptionPane.showMessageDialog(null,"Please re-enter the time", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); }} E11 Logged Main form Formatting date, format check Format check Date newDate = new java.util.Date(); SimpleDateFormat ft = new SimpleDateFormat ("E yyyy-MM-dd");

The user will be able to edit the time entered and re-enter it into the database. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, as the program will not fix it itself.

jLabel14.setText("Date: " + ft.format(newDate));

The output will be the date in a formatted way, in order to both save the file and read the file with a common system, and also to display it in a specific way. The computer will be able to solve this error without user intervention. And this error does not need to be informed to the user, as the program will fix it itself.

Computer Science Coursework 58

Computer Science Coursework Abhi Agarwal


E12 All Forms The specific data, such as Difficulty, Time taken, subjects, which is required to be standardized. E13 Add Member Length check Verification check (Repeating twice to check if same input) The standardized data such as time taken, subjects, and difficulty has been put into a combo box in order to reduce the spelling errors, or the formatting errors in the program. Therefore the time will be within the specified range each time, and also the format check will be not required as the data will be in the correct format each time. The subjects that will be allowed will be displayed and not subjects, which the user does not require. For example: This is not an error, but an action that will reduce the error, and therefore the user or the computer does not require to fix this error, it is self correcting.

In add member, there is a function that makes sure that the length of the pin is four digits, which is a validation length check. And another function that makes sure that the two four digit codes are equal, therefore verifying that the passcode entered is correct. if(passwordadd.equals(DescField57.getText())) { if(passwordadd.length() > 4 && passwordadd.length() < 4) { JOptionPane.showMessageDialog(null,"Please enter a four digit pin and try again!", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); } else { code } } else { JOptionPane.showMessageDialog(null,"The two passcodes don't match try again!", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); }

It will output either, the two passcodes dont match, or please enter a four-digit pin code, and the user has to input it again. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, as the program will not fix it itself.

E14 Add Members Maximum Amount of tasks Length Check

if(Timetable_main_RWRAF.getLength() < 11) { else { JOptionPane.showMessageDialog(null,"You've reached the maximum amounts of tasks you can add - 11", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); }

There is a maximum amount of tasks you can enter into the database, as the simulation will only accept a maximum number of 11 tasks.

Computer Science Coursework 59

Computer Science Coursework Abhi Agarwal


E15 Mac or Windows error To make sure the user enters the correct value, and also to stop it from having a hardware error. E16 Add Member Pin code In order to check if the pin code entered by the user to add a new member was a Integer or a string I used a NumberFormat Check Format Check } while (!inputValue.toLowerCase().contains("m") && !inputValue.toLowerCase().contains("w")) { inputValue = JOptionPane.showInputDialog( "What operating system are you currently using: M - Macintosh, W - Windows" );} If the user enters wrong data itll just keep asking the user to re-enter the data, the computer wont be able to solve this error, the user has to intervene.

Boolean passcodeRight = true; String passcodecheckX = DescField55.getText(); try { int PCCHECK = Integer.parseInt(passcodecheckX); } catch(NumberFormatException ex) { passcodeRight = false; JOptionPane.showMessageDialog(null, "Please enter the passcode as an Integer"); //Displays an error message if the length is not in minutes } if(passcodeRight == true) { code

If the user enters a string instead of a integer it wont be accepted, and the user will have to manually enter the data again. The computer cant solve the error the user has to intervene.

Accidental errors User Accidental errors Error # How to handle error Consultation

Computer Science Coursework 60

Computer Science Coursework Abhi Agarwal


E17 Logged main form When the user tries to logout from the system private void logoutMenuActionPerformed(java.awt.event.ActionEvent evt) { // Modal dialog with OK button int response; response = JOptionPane.showConfirmDialog(null, "Are you sure you want to log out?"); If the user chooses to logout, a message box will pop up asking the user to confirm if the user wants to log out of the system. Such as that shown below:

if(response == 0) { new Login_form().setVisible(true); this.setVisible(false);// TODO add your handling code here: } }

E18 All other forms Click the top exit button E19 After data is added

The top exit button does not work when the user tries to click it, but the user has to click the Return Button, that button only works when the user exists from the Login menu. This is to protect the user for data loss, as the whole program will close.

After data has been added to each of the forms, such as add data, or edited in edit data, the form will close and return to the main logged in screen.

E20 Opening multiple forms at once

The user will not be able to open multiple forms at once, but will be able to open only one form at once, and when that form is closed other forms will be able to be opened, this is in order to make sure that the data isnt written or added twice at the same spot, which would create errors. To make sure that data isnt clashing.

The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, as the program will not fix it itself. The computer will not be able to solve this error without user intervention. And this error does need to be informed to the user, so the user can fix the error. This is not an error, but an action that will reduce the error, and therefore the user or the computer does not require to fix this error, it is self correcting. This is not an error, but an action that will reduce the error, and therefore the user or the computer does not require to fix this error, it is self correcting.

E21 Add Member When the user adds a new member, and accidently sets the length of the new member

if(usernameadd.length()<11) { code else { JOptionPane.showMessageDialog(null,"The username is too long, please reduce it to 10 letters", "Timetable Management Program", JOptionPane.INFORMATION_MESSAGE); }

This is not an error, but the user will have to fix this in order to proceed, the computer wont be able to self-correct this error.

Computer Science Coursework 61

Computer Science Coursework Abhi Agarwal


as more than 10, this message will show up. Length check

Deliberate Errors User deliberate errors Error # How to handle error Consultati on
This will backup the files into another directory. The computer will be able to solve this error without user intervention. And this error does not need to be informed to the user, as the program will fix it itself.

E22 Logged main form Backing up the files in order to protect the files if they get corrupted, or if someone deletes the files deliberatel y.

private void logoutActionPerformed(java.awt.event.ActionEvent evt) { int response; response = JOptionPane.showConfirmDialog(null, "Are you sure you want to log out?"); if(response == 0) { File formerdirectory = new File(Homework_datetimecheck.urlpart0); Date newDate = new java.util.Date(); SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd"); File targetdirectory = new File("/Users/Abhi/Desktop/Database/Backup/"); try { FileUtils.copyDirectory(formerdirectory, targetdirectory); } catch (IOException ex) { Logger.getLogger(login_area.class.getName()).log(Level. SEVERE, null, ex); } new Login_form().setVisible(true); this.setVisible(false);// TODO add your handling code here: } }

D1 Sample runs (S Sample Runs) S1 - Add the tasks and the different homework (in terms of subjects), add the description of each homework, add the time required for each homework and task, and set the priority of the tasks (in terms of importance). Then add these into a database generated by the program. Computer Science Coursework 62

Computer Science Coursework Abhi Agarwal The subjects will also be auto-generated by the program and not inserted by the user. This form adds the subject, the description, the difficulty and the time of the task taken entered by the user on this form as a new record in the database. These details are then saved into an object of Homework_database and wrote into the random access file and the linked list.

Add the tasks and different homework

Add the description of tasks for every type of homework

Set the priority of the tasks

Add the time required for each homework and task

S2 - Generating the subjects

Computer Science Coursework 63

Computer Science Coursework Abhi Agarwal

It generates the list of subjects by reading the random access file of the current logged in user, and searches for his subjects field.

Computer Science Coursework 64

Computer Science Coursework Abhi Agarwal S3 - Delete the tasks and the different homework (in terms of subjects and in this case also ID) This form deletes the specified homework by the user from the Homework database; the user is able to select the ID, subject, description or the time taken as a preference to what he/she wants to delete using. The program then flags the delete field of this record as 1 and saves into an object of Homework_database and writes into the rand om access file and the linked list.

Delete the task and the different homework (in terms of subjects and ID)

Computer Science Coursework 65

Computer Science Coursework Abhi Agarwal S4 - Edit the tasks and the different homework: edit the description of tasks for every different homework, edit the time required for each homework, edit the priority of the tasks (in terms of importance) This form edits the specified homework by the user from the Homework database; the user is able to enter the subject, description, difficulty, the time taken, and these are non-optional. The program then overrides the field of this record with this data saves into an object of Homework_database and writes into the random access file and the linked list.

Edit or leave the same subject if required by the user Edit the description of the homework that was entered previously by the user

Edit the priority of the tasks (in terms of importance (easy, medium, hard))

Edit the time required for each homework. Computer Science Coursework 66

Computer Science Coursework Abhi Agarwal S5 - Allow free time and take consideration that Mr. Kothari might get distracted at some points. Also gives the optimum sleep time required by the user (taking into account they finish their work). It outputs a simulated timetable of the day, and the estimated time of completion. This form allows a timetable to be generated: that gives the user free time, the optimum sleep after their homework has been finished, and simulates a timetable of the day. It also outputs the estimated time of completion. The algorithm behind this searches the homework to calculate the total time required and asks the user to suggest a time to start the process. The demonstration below is one that starts the homework at 8:00am, and in this case the user finishes his homework in 2 hours by 10:00. Estimated timetable of completion: In this case it would be 10:00, as it gives a 15minute cool-down period.

Allows free time and takes consideration that Mr. Kothari might get distracted at some points, and give a 15 minute break between every 2-4 activities.

After the user is finished his work, it gives them the optimum sleep and free time that is required by the user.

Sort and prioritize the homework into numbers. Computer Science Coursework 67

Computer Science Coursework Abhi Agarwal S6 - Create the same basic environment Mr. Kothari uses, and lists the current homework to the user in a table format. In order to allow him to have a similar environment as before I have created a timetable view, which is the closest thing to a whiteboard that could have been used. This will allow him to see all his homework in a clear timetable view, and he will be able to keep this tab open. Displays all the homework categorized in the different subjects

Displays all the homework categorized in the different descriptions

Displays all the homework categorized in the different difficulties

Displays all the homework categorized in the different times

Computer Science Coursework 68

Computer Science Coursework Abhi Agarwal S7 - Print the timetable and homework as displayed by the table, or within the database itself. As stated by the client, this program needs to be able to print the timetable that has been generated by the database, and this form will be able to print it. This program will also print the Homework database that can be seen in the Homework database table as shown above. Generated Timetable The user will be able to choose the printer it wants to print using, in this case a HP printer.

The user will also be able to choose the page setup, the page size, Ect.

The user will primarily click the Print button and it will popup the menu. This is a form of the timetable that has been generated.

This is the button for it to send it to the printer.

Computer Science Coursework 69

Computer Science Coursework Abhi Agarwal S8 - Homework Database

The Homework Database table has been generated from the Linked List and the database.

The user will primarily click the Print button and it will popup the menu. This form will be the same as the previous print function.

Computer Science Coursework 70

Computer Science Coursework Abhi Agarwal S9 - The user will be able to add users to the database, and control who has access to the program, and the subjects will be auto generated and the user doesnt have to insert them himself. This program will be able to add multiple users to the program, who will be able to access and add their own homework. The databases of different users will be kept different on a day -to-day basis so everyone is able to access the right homework. The user is added to the database initially, and this is static throughout the program. When homework is added to the database, these selections of subjects are shown for the user to add. This is the username that is required for the user to authenticate into the program. This is the 4-digit pin code that the program uses for authentication. The user will type this twice for confirmation and the program will check if it's the same.

The user will primarily click the Add user button and it will insert the user into the database.

The 7 groups of subjects you have in the IB, all the subjects possible are already put into a combo box, to save time. Computer Science Coursework 71

Computer Science Coursework Abhi Agarwal S10 - View users in the database. All the users within the program will also be able to view all the users, but they wont be able to see the Password or the Passcode of the different users. This is the username of the different users in the database.

The password in this form is hidden so that other users cant login and authenticate into the program.

This button will different users to view all the different users, it will allow them to go back and forth on different records.

The users will all be able to view all the subjects of each user.

Computer Science Coursework 72

Computer Science Coursework Abhi Agarwal S11 - Easy and simple to use for Mr. Kothari as it shouldnt take more than 5 minutes a day to put information into this program database. The menu is adaptable and easy to add/edit/delete/view/search and simulate. The menu opens next to it, and is easy to close. The File/Edit/Print is also easy to use. There are easy to use keyboard commands such as control A, in order to open the administration menu. This will be quick and easy, and Mr. Kothari will be able to adapt to them easily. The menus also open side by side so they will be able to quickly add and close them. These menus have keyboard commands in order to increase efficiency for the user.

The forms from default open in a side-by-side layout in order for the user to quickly access them and be able to intuitively predict the location of the forms. Computer Science Coursework 73

Computer Science Coursework Abhi Agarwal S12 - The backups will be taken by the program itself, this will take backups daily and override all the files. The program when logged out of the program will backup the databases itself and save them into a backup folder. This is the folder of the backups that are saved when you have logged out from the program.

Below this one are the files for the database itself, these are saved within the directory and it is made for both Mac and Windows directories.

This is the code that allows the program to backup when the logout sequence is started; it copies the directory into a separate directory.

Computer Science Coursework 74

Computer Science Coursework Abhi Agarwal S13 - The predefined range of the homework will be 0 -3 hours, so Mr. Kothari wont be able to add homework, which is more than 3 hours long per day. When youre adding the homework, the pre -defined till will be 15 minutes to 180 minutes, and it will allow the program to have a predefined range check. It saves an error to be created within the program. The task time in minutes goes from 15 minutes to 180 minutes, therefore it will go from 0-3 hours.

Computer Science Coursework 75

Computer Science Coursework Abhi Agarwal S14 - It will only handle a single user at a time, only one user can use the program at one time from one computer. This single-input user login system will only be able authenticate only one user at one time. Only one person will be able to login to this form at one time.

Computer Science Coursework 76

Computer Science Coursework Abhi Agarwal S15 - Program settings. This is where the part of the program where the user will be able to pick what time he wants to start generating the timetable at that point. It then saves it into a database and is read every time, and it is saved specifically for every different user. The time goes from 8:00 to 20:00, this is the time where the person will start working.

Computer Science Coursework 77

Computer Science Coursework Abhi Agarwal S16 - First time user created. When a new user uses the program for the first time, the program recognizes this, and pop-ups a different form for that user to put their details in.

Allows the first user to enter his details about the subjects and the username and password.

Allows the user to choose when to start studying, and set the time to simulate the timetable.

Computer Science Coursework 78

Computer Science Coursework Abhi Agarwal S17 - Mac or Windows The program will ask the user to decide whether the computer he/she is using is Windows or Macintosh.

The user will either enter m or w either for Mac or Windows, which will then change the URL of the file accordingly. Summary These satisfy the objectives which were proposed in A2: Mr. Kothari is able to add, edit, and delete tasks for every homework and the description, time and properties. This then is generated and sorted to allow for the maximum free time, and the optimum sleep th at he can get, and gives the same basic environment as before. This then is outputted to give the estimated time of completion and simulates a timetable of the day. Then Mr. Kothari is able to print this or use it in the way he requires to do so, also as a Table. It is easy to use and the clean menu allows for quick adding of information, and the command keys (when used too) can help the process be quicker. Backups are self-taken and the subjects are also generated by the user to decrease them typing it. Th ere are error checking embedded within the program, and this allows the errors to be caught before the simulation is ran. The program is also secure and uses a ten -digit pin system, which would mean that there would be 10! (10 factorial) ways to crack the system. There are 3 628 800 ways to break the system, and this would take a long time to crack it. This program is also written in Java so it can be used in both Windows or Mac as required by the user in the future. However, the program also only allows h omework from 1-3 hours, as shown by the user having to select the time frame, and this program will only work on Windows or Mac as there is no Linux support and Mr. Kothari hasnt expressed the wanting to use Linux. There is also no

Computer Science Coursework 79

Computer Science Coursework Abhi Agarwal support for applications on the computer, and also messaging. It is single-user environment, so only one user uses at it a single time. Errors (EM Error Message) EM1 - Login Screen (ERROR E4) This is the error generated when the username or password is incorrect in the database, or in this case it is not found!:

EM2 - Logout Message (ERROR E16) This is the option that is given to the user when the user wants to log out, this is a verification check:

EM3 - Opening multiple forms at once (ERROR E19) This is an error generated when multiple forms are trying to be opened, so you are only able to open one form, and when you close it you can open another one:

Computer Science Coursework 80

Computer Science Coursework Abhi Agarwal EM4 - Add Members - Validation length check, and verification check (ERROR E12) When two passcodes are different then it will generate an error message to ask the user to re-enter the passcodes again. This is the form of what it would look like when you are adding the code:

I have now entered data into the passcodes, and I have entered the 4 Digit Codes differently:

It will now generate this error message to show that the two passcodes dont match, the user has to re-enter the data.

Computer Science Coursework 81

Computer Science Coursework Abhi Agarwal EM5 - Add Tasks Limiting the amounts of tasks (ERROR E13) There is a limit on the amount of tasks that you can add to the database, it is 11 in this program, and there will be an error generated when one tries to add more than 11 tasks. This is what the error would look like:

EM6 - Add Tasks/Edit Tasks 500 word limit on the description (ERROR E5, E6) There is a limit on the size of the description that you can add to the database, it is 500 words in this program, and this particular error will be generated if the description is larger than 500 words. This is what the error would look like:

Computer Science Coursework 82

Computer Science Coursework Abhi Agarwal EM7 - Member file not found error (ERROR E2) There will be no error generated but it will create a new member in the database, this is the form that will pop up in order to do this:

EM8 - Changing Operating system (ERROR E14) When the user tries to change the operati ng system there is a check that the program asks to confirm if the choice they have made is correct.

EM9 Checking space left (ERROR E3) When the program loads and if there is not sufficient amount of memory this message will popup telling them to fix the space.

Computer Science Coursework 83

Computer Science Coursework Abhi Agarwal EM10, EM11 Add new member (ERROR E20, E15) EM10 - When the adds a new member, the username has to be lower than or equal to 10 letters, or this error will be displayed to the user:

EM11 - When the adds a new member, the password has to be a integer or this error will be displayed:

Computer Science Coursework 84

Computer Science Coursework Abhi Agarwal Testing (T Testing) In this section we will test the different types of data that can be used in the program, and the messages that will show if the user enters these different types of data. We will consider normal data, abnormal data and extreme data. Normal data is data that should be accepted by the program, abnormal is data that should be expected by the program, and it is not expected. And extreme data is data that is outside the n ormal limits of the program. T1 - Login Screen (Section S14)

Data Type Normal Data

Data Used AbhiA

Expected Result Authentication to the program.

Abnormal Data

Username is not authenticated. Data rejected. Error Message.

Actual Result Expected result is true. Authentication granted. Expected result is true. Pop-up message saying to enter the string. Check error message EM1. Expected result is true. Pop-up message saying username and password not found. Check message EM1. Expected result is true. Pop-up message saying username and password not found. Check message EM1.

Extreme Data

NotaUser

Username is not authenticated. Data rejected. Error Message. Username is not authenticated. Data rejected. Error Message.

Normal Data, with spelling error

AbhiAA

Computer Science Coursework 85

Computer Science Coursework Abhi Agarwal T2 - Add Screen (Section S1) In this we will be checking the Description error and data entered into those because the other fields are Combo Box, so the user has to choose data, and therefore there wont be an error. But we will be entering all the data.

Data Type Normal Data

Data Used Computer Science, Coursework, Easy, 15 Computer Science, \, Easy, 15

Expected Result Record is added at the end of the file.

Abnormal Data

Record is added at the end of the file. Data is still added.

Actual Result Expected result is true. Data is added at the end of the file. Expected result is true. Data is added at the end of the file.

Extreme Data

Computer Science, Coursework is the easiest thing to do, leave to later it is 500 pages long . (500 words), Easy, 15

Description is too long; error message will pop up, Data rejected.

Expected result is true. Pop-up message saying username and password not found. Check message EM6.

Computer Science Coursework 86

Computer Science Coursework Abhi Agarwal T3 - Edit Screen (Section S4) In this we will be checking the Description error and data entered into those because the other fields are Combo Box, so the user has to choose data, and therefore there wont be an error. But we will be entering all the data.

Data Type Normal Data

Data Used Computer Science, Coursework, Easy, 15 Computer Science, \, Easy, 15

Abnormal Data

Expected Result Actual Result Record is edited at the Expected result is same place. true. Data is edited at the same place as added previously. Record is edited at the Expected result is same place as added. true. Data is edited at the same place as added previously. Description is too long; error message will pop up, Data rejected. Expected result is true. Pop-up message saying username and password not found. Check message EM6.

Extreme Data

Computer Science, Coursework is the easiest thing to do, leave to later it is 500 pages long . (500 words), Easy, 15

Computer Science Coursework 87

Computer Science Coursework Abhi Agarwal T4 - Windows or Mac screen (Section S17) In this we will be checking if the computer of the user is Windows or Mac, the user will take the input of w or m and we will test this below.

Data Type Normal Data

Data Used m

Abnormal Data

Expected Result Data is taken as an input from the user, and saved as the input. Data is rejected, and will ask the user to reenter the data.

Actual Result Expected result is true. Data is added to the variable. Expected result is true. Error message has popped up, Check S17, same message box is shown, Expected result is true. Error message has popped up, Check S17, same message box is shown, Expected result is true. Data is added to the variable. It is defaulted to Mac, as it checks for m first.

Extreme Data

Data is rejected, and will ask the user to reenter the data.

Extreme Data

mw

Data is rejected, and will ask the user to reenter the data.

Computer Science Coursework 88

Computer Science Coursework Abhi Agarwal T5 - Add user (Section S9) In this we will be checking the Username, and the Password to find the error in data entered into those because the other fields are Combo Box, so the user has to choose data, and therefore there wont be an error. But we will be entering all the data.

Data Type Normal Data

Abnormal Data

Data Used Abhi, 1234, 1234 English, Spanish, History, Physics, Mathematics, Music, None Abhi, abcd, abcd English, Spanish, History, Physics, Mathematics, Music, None abhiagarwal, 1234, 1234 English, Spanish, History, Physics, Mathematics, Music, None

Expected Result Record is added at the end of the file.

Actual Result Expected result is true. Data is added at the end of the file. Expected result is true. Error message has popped up, Check message EM11. Expected result is true. Pop-up message saying username and password not found. Check message EM10.

The data is rejected, and an error message will pop-up saying to re-enter the passcode as an integer. The username is too long; error message will pop up, Data rejected.

Extreme Data

Computer Science Coursework 89

Computer Science Coursework Abhi Agarwal D2 Evaluating Solutions In this section I will firstly evaluate how successfully I have met the objectives listed in A2, and then I will talk about how effective, efficient this program is. I will also suggest the improvements I could make in future versions of this program, and any alternative methods I could have taken in the development of this program. Objectives As in the analysis, the program needs to be able to: As required by analysis, the program must collect this relevant information from Mr. Kothari, therefore he will be able to (Figure 3): o Add, edit and delete the tasks and the different homework (in terms of subjects) o Add, and edit the description of tasks for every homework o Add, and edit the time required for each homework o Set and edit the priority of the tasks (in terms of importance)

The program is able to add, edit, and delete different tasks, while also being able to edit the description, time and the priority of the tasks. This is the heart of the program, as without these key features the program becomes useless. These objectives have been fulfilled and shown in S1 in the D1 Criteria. Allow free time and take consideration that Mr. Kothari might get distracted at some points, o Break given 15 minutes between every 2-4 activities

When generating the timetable, the program considers 15-minute breaks between 2 activities; this is shown in S5 in the D1 Criteria. Give the optimum sleep time required by the user,

The optimum sleep is calculated after the user has finished the homework, so this criterion hasnt been fulfilled to its maximum extent where it doesnt allow the user to add more tasks after it has reached a certain amount of hours. However, it has been adapted to sleep after the homework has been finished, and if he wishes to make-up for the sleep on the next day, he could take a nap and change the starting time of work in the settings page. This objective has been fulfilled and shown in S1 in the D1 Criteria. Create the same basic environment that Mr. Kothari currently uses, and provide a listing of the homework,

Features such as the View Homework Table are used to create the same basic environment, as it would be an alternative for the Whiteboard. It would display the homework in the same way a whiteboard would do. It would also have similar effects as Sticky notes, however the user wont be able to add notes on the View Homework Table. This is shown in S6 in the D1 Criteria.

Computer Science Coursework 90

Computer Science Coursework Abhi Agarwal Process, and calculates the information above and: o Add it into a database

The homework is added to the database, using the random access binary file. The add function adds it to the database; this objective has been fulfilled and shown in S1 in the D1 Criteria. Run an algorithm to: Sort and prioritize the homework into numbers Search the homework to calculate the total time required to do the homework and the time Mr. Kothari has after the school day and give Calculate an estimate of how long he needs for each homework, and store that into the database

The program uses quicksort in order to sort and prioritize the tasks into numerical values, which can be put into tables, and allows the user to calculate the time required to finish the homework at the end of the day. This is all then calculated and put into a table, which is outputted to the user. The user enters the amount of time he requires in order to do each homework. The output of this program will be: (Completes Table1) o The list of homework of the user (Figure 1) o Estimated time of completion o Simulated timetable of the day o Print the simulated timetable and the homework as stated in the analysis

The program outputs this data in tables, and this object have been fulfilled and shown in S5 in the D1 Criteria. It then simulates the timetable of the day and outputs it as a table. The user is then able to print the homework and the timetable, as shown in S7 and S8 in the D1 Criteria. The user controls: Who has access to the program o Add users to the database View users in the database

In the program you are able to add users to the database and view users in the database, we can see this fulfilled in S9, and S10 in The D1 Criteria.

Computer Science Coursework 91

Computer Science Coursework Abhi Agarwal Security and Performance: Easy and simple to use for Mr. Kothari as it shouldnt take more than 5 minutes a day to put information into this program database, the program will use online processing as the processing done has to be fast and simple for the user to see and comprehend, and has to be static and be available to preview at all times

The program is simple-minded to use and only requires a few minutes everyday. The user only requires to enter the homework into the database and simulate it, it does not require to edit/delete if it is not required to do so. S11 of Criterion D1 shows that the menu is adaptable and some of the key features of this program make it easy and simple to use. The subjects will be auto generated and would not have to be set up by Mr. Kothari (As easy to add as with Figure 3)

The subjects are generated by the program itself, the user does not have to manually input the subjects into the text fields. This saves time for the user to type the whole word out each time he adds homework. This criterion has been shown in S2 in the D1 Criteria. Mr. Kothari does not have to take back-ups himself in Windows Explorer, the program will be responsible to take daily or monthly backups for Mr. Kothari However a requirement could be to tell Mr. Kothari to take backs up incase of data loss.

The program is able to back-up the files by the program itself, and then Mr. Kothari is able to retrieve those files in case of an emergency. However, a full backup if required has to be done by Mr. Kothari and the program wont do it. This utility is listed in E22 in the C2 criterion. Has adequate error handling so if Mr. Kothari accidently puts in wrong information into the program, such as an extra digit when he is entering the number of hours, he is able to catch the error and throw it back or else: o There will be validation checks to check for this, the following will be implemented into the program: Presence check if he has actually put in the information required Length check if the information required is within the right range, such as the number of hours is in the correct number of digits the data will be processed Range check if the data lies within a correct range of subjects o As this will lead to Mr. Kothari being faced with errors and will disturb him from work. Moreover the simulation would also have errors.

The program has adequate error handling, such as Format checks, Range Checks, Length checks, and Presence checks. These errors have been documented in the C2 Computer Science Coursework 92

Computer Science Coursework Abhi Agarwal criterion, for example: E2, E5, E6, E8, E9, E11, E13, E14, E16, and E21. These help to decrease the errors created by Java or in the simulation of the final product.

The program must be secure, so people arent able to tamper with the information, and Mr. Kothari is given a password and a username. Which allows him to login to the program. The program will be programmed for a multi user environment, so many people can use the program and as it can be used in Mr. Kotharis household. We have left it to Mr. Kotharis preference if he wants to use it as a multi-user or a single user program.

The program runs on a 10-digit pin login system, with the possibility of having multiple users. You can see this in S14 in the D1 criterion. It is secure and you require the pin of the other user in order to tamper with his/her information. Able to run on his Windows 7 Lenovo ThinkPad machine, however if needed will also be able to run on other computers, if Mr. Kothari decides to switch over to another platform: o Written in Java so it can run in different platforms, such as Macintosh while also running on Windows 7. o The program will be written for online processing, and not batch processing.

The program is written in Java, and S17 of the Criterion D1 shows that it is multiplatform. The user is able to input what operating system he/she is using. The program will also be able to print the timetable, so Mr. Kothari will have to use the timetable on the machine, Mr. Kothari said that he need it to be able to print, but he is also happy to be able to keep the program open to preview his timetable.

The user is able to print an A4 (or any type of sheet) for the timetable and the homework database. This is shown in S7 and S8 of criterion D1. Scope and Limitations: The predefined range of the homework will be 0-3 (or 15-180 minutes) hours, so Mr. Kothari wont be able to add homework, which is more than 3 hours long per one day.

This limitation is still enforced on the program; you are only able to add 15-180 minutes on every morning. This is a permanent limitation on the program as tasks should usually be broken down into chunks and should not be beyond 180 minutes in length. This program will be developed for a dual Mac and Windows system, and will be only able to save the files on, and not systems such as Linux.

Currently the user does not require the program to be able to run in Linux, but the change in file format would be easy to adapt with, as it is a few changes. This is a limitation to the program, but if required could be fulfilled easily. Computer Science Coursework 93

Computer Science Coursework Abhi Agarwal It will only handle a single user at a time; however, it will be created for a multiple user accounts environment. One user can use the program at one time from one computer.

You arent able to login to the computer multiple users at a time but you have to login as a single user each time. This is not a limitation to the program but a boundary; a multi-login system would not be developed as a change in future versions. The program will not be able to generate and send mail messages into inboxs of other people or Mr. Kothari himself.

This is a limitation in the program, the program isnt able to communicate with email or such technologies. This is because no every computer or a user has a mailing server that he/she is able to connect too, and programming to add additional forms for the user to fill for a mailing form decreases the efficiency of the program. The program will not be able to access any other files on the computer, such as address book, calculator, dictionary, spell check, files and pictures.

This is a limitation in the program, future versions will be able to integrate technologies like the calculator, and the dictionary if required. Such as a spell check, and also to be able to import and save files for future uses as a part of different homeworks, for example the user could import a word document for Spanish when adding the Spanish homework task. Outline The solution provided using NetBeans IDE and Java Framework answers most of the criteria suggested by the user and encompasses most of the problems suggested within the analysis. This solution allows the user to input the different homework or tasks they have over a period of that day and simulates a timetable including breaks to the user. This homework can also be edited within the program itself, or deleted if the user decides to remove the homework from the database. It also allows the user to narrow down to find specific homeworks they have entered using the search function. The Graphical User Interface increases the efficiency and the simplicity of the program itself, and in my opinion the simple-mindedness of the GUI makes it simple to use over other tools. The program doesnt require the user to enter a lot of information but most of the data input is in Combo Boxes so the user is selecting the Homework. There are also shortcut keys for a lot of the tools, so the user is able to adapt to those short cut keys, such as the Administration being (control A). The location of the program is also with constants, and the user is able to use the program in both Windows and Macintosh, which allows the user to be flexible in what computer in using in the future. The length of the code of the program itself is long, but it is spread over a variety of functions, such as the simulating, the adding, editing, removing, searching, printing and many other functions. Moreover, the speed of the program is also relatively quick. Computer Science Coursework 94

Computer Science Coursework Abhi Agarwal There was also a limitation in the program, the import of the school homework was not possible, as Java wasnt able to communicate with the school system, and so it makes it harder for the user to log the homework as they might have to go to the school database first. This would increase the time taken for them to log the homework onto the database. Another limitation in the program is that the simulation does not consider the difficulty of the homework, but only considers the time taken. This is something that should have been added in the program, and in future versions would be added. Efficiency There are a few issues in the efficiency of the program but these don't significantly impact the runtime of the application, sometimes the BigO notation of the functions are high. The functions within the simulating timetable code has functions, which have a efficiency of BigO(n^2), there are for loops within for loops. This decreases the speed of execution of the program, and overall it makes the process of generating the timetable longer. Possibly the program could be handled with a single-user environment where we only have one user, this would decrease the amounts of files that need to be handled. It would decrease the complicated process of authenticating users and to save the homework into different random access files per the different users, and this also reduces input/output errors within the program, which lead it to throw an error if missing. Effectiveness The pin system is an effective way of securing data, but also allows the user to only remember a short 4-digit number. However, on average I believe that it takes longer for the user to manually type a pin code then to type a password in, and so it is an effective solution but this decreases its effectiveness. Looking back, using a typical String password would have reduced the time taken, but it would also have increased the memory space taken in the database if the password used was longer. The user might have also forgotten the String password, while the user would remember the passcode. The use of Combo Boxes has increased the effectiveness of the program, as it saves time for the user to manually input all the data. This is a simple solution, but the user only has to use the mouse to click the buttons and choose the correct fit subject, difficulty and time. The user however has to enter the description of the homework in order to submit the homework. After the user enters all the homeworks required, the simulation of the homework is fast it is just one button click. Improvements and possible extensions A possible extension would be to import Excel Spreadsheets from the school database that has generated the homework for each pupil, and import it for the current pupil and import it into a jTable. This can then be formatted and shown to the user in conjunction to their Add Homework module. This would increase

Computer Science Coursework 95

Computer Science Coursework Abhi Agarwal the effectiveness of the program, but also the efficiency as to how fast the user completes the work. For the pin system, a possible improvement would be to use keyboards to detect each button click, so if the user clicks the key 1 it would have an action listener on the button and enter it as a pin. This would merge both the two types of passwords together and this would be a much more effective system. This program would also work on a touch screen environment, as most of the data inputs are based upon touch, such as the Combo Box, but the user will require to enter data using the on-screen keyboard. The file menu could be used in touch sensitive environments, as the separation between the file menus is enough for a finger to touch. In the future, the simulation model could also consider the difficulty of the different homeworks, and also capture key words within the description. This would allow the most important homework to be ranked in order, and the user would be doing the most important homeworks first. Currently it only uses a quicksort algorithm and sorts it with a ascending order to time taken, but in the future it would also consider difficulty, and also the rigor of the subject itself. This would be more effective in capturing when the user should do a certain homework. This was too difficult at that time when creating and planning the program, but looking back I would have been able to consider the difficulty at the minimum. Alternative approaches An alternative approach to using Random Access Binary Files would have been to use databases, either a SQL database or a Microsoft Access database, or a database generated by NetBeans the Integrated Development Environment framework I used. This would be simpler as data input and output would be simpler, and faster. But we would only require main database with many different records within it, they could also link to different databases, and the simplicity of a program such as Microsoft Access would allow the user to fix if there were to be errors. The use of SQL databases in the future would also allow to extend to a website format, as we could use PHP and SQL databases to export the timetable or the tasks online so the tasks could be viewed online by the user, which would increase the effectiveness of the program as it would be more portable. The use of relational databases would increase the flexibility of the design of the databases, as we wouldnt be restricted to the java primitive data types, but we could also use the input and output of for example Date as a type of data storage. In general we could have used PHP as the main programming language of this program. PHP is also a object orientated programming language, and therefore has similar features to that of Java. However, it is web-based so it increases the portability of this program, as the user is able to generate and add homework using any device, such as his/her phone. This is unsecure, and unreliable as if the webserver doesnt respond the user could be set back in doing his work, as he would not have the guided timetable for him/her to follow. Computer Science Coursework 96

Computer Science Coursework Abhi Agarwal Moreover, an improvement could also be to use another type of sort. Multiple sources online show that the Radix sort2 is more efficient, faster, than quicksort for integer arrays. In the case of this program we are using an integer array, and so switching to this sort, in theory would reduce the factor of time by at least two times. Overall, this would increase the effectiveness of using the program, and the user would have to lose less time in committing to work. Another approach could be to remove the login system all together, if we are making this for a single-user environment on a single computer, we are able to create this for only 1 user. Removing the login-system would decrease the time to login to the program, and for the program to find the correct binary files for the correct user. However, the login system has been used to broaden the market or scope of this solution. Other individuals, or even institutions could use this with multiple pupils logging in and out. This could also be used as a test facility in research to see how much work students get and how they are able to stay on track with their work. But, removing the system all together for Mr. Kothari could be a viable solution for him. Lastly, using a command line and not a GUI is also an option to increase the effectiveness of this program. The user merely has to input a few words each time, such as the Subject, the Description, the Time, and the Difficulty. This could be a solution that could use a command line interface. The loading of the graphical user interface increases the time spent by the user in using this program. It would also be more efficient if the program would be written in command line as we would take the user input, and wouldnt have to keep waiting for every input of the user in Text Boxes. In conclusion, I believe that the solution created for the user is effective and efficient in the criteria it has achieved. The program is a good solution for the user to track their tasks, and keep a record of them. Also to generate a timetable to show what work they should do. There are flaws within the methodology in the generation of the timetable in the program, however overall this is a great solution proposed to the user.

http://erik.gorset.no/2011/04/radix-sort-is-faster-than-quicksort.html Computer Science Coursework 97

Computer Science Coursework Abhi Agarwal

Dear Mr. Agarwal,

Thank you for your email, well as per the specific features, I would like to see these different types of features embedded in the program: - What homework do you have today, - How long do you have to complete these tasks: And then I wish for it to go into more detail - What homework do you have today, Details to: - Importance of task: - Estimated time of completion: - Description of homework: I would also like to request for a simple login script, just one user if possible just to be sure other people don't access my account when I am not at home, and also a nice user graphical interface as I prefer the ease of use over functionality. Thank you, Anant Kothari ________________________________________ From: Abhi Agarwal Sent: Tuesday, June 20, 2011 6:09 PM To: Anant Kothari Subject: In regards to the program Dear Mr. Kothari, I hope youve had a great day, I was emailing in order to ask about the program I was going to create you for your daily routine and schedule, what type of features would you like me to create for you? Please reply as soon as possible, Thanks, Abhi Agarwal

Computer Science Coursework 98

Das könnte Ihnen auch gefallen