tag:blogger.com,1999:blog-210342372009-02-21T06:23:04.518-08:00Tarek's IB CS BlogTarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-21034237.post-1141618398115270472006-03-05T20:05:00.000-08:002006-03-05T20:13:18.130-08:00Final Week Review<strong>Objectives Set For This Week:</strong><br />Last touches and error checking.<br /><br /><strong>What Has Been Achieved:</strong><br />During the course of the programming, I had decided not to use Random Access File. After completing most of the program, I realized it would be better to use it for mastery factor purposes. I spent this last week making the Random Access File controller class and changing the forum management system to utilize Random Access File. By doing this, I gained three mastery factors for adding, removing and searching a Random Access File. The program is now complete and all final touches have been made.<br /><br /><strong>Grade:</strong><br />Since all objectives have been achieved, I think I deserve a 20/20<br /><br /><strong>Running Code:</strong><br /><br /><em>Note: I can't show the files created by the Random Access File controller because they are a lot of white space and mess up the blog. I can show them to you in class if you want. Below is the code of deleting and adding data.</em><br /><br /> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: lamia<br />Last Name: mazhar<br />Login Status: Director<br /><br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Assign Countries<br />D) Logout<br /><br />-------------------<br />Choice: b<br /><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Country From Forum<br />C) Remove All Countries From A Forum<br />D) Remove All Countries From All Forums<br />E) Main Menu<br /><br />------------------------<br />Choice: d<br />Are you sure you want to remove all countries in all forums(Y/N)? y<br />All Forums Removed<br /><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Country From Forum<br />C) Remove All Countries From A Forum<br />D) Remove All Countries From All Forums<br />E) Main Menu<br /><br />------------------------<br />Choice: a<br /><br /><-- Add Forum List -- ><br />This program can read CSV files containing country lists.<br />The file must be formatted as (CountryOne,CountryTwo,CountryThree).<br />You may either write the entire address of the file below, or drag the file into the console and press enter.<br />-----------------------<br />Forum Name: ga<br />List Location: gena.txt<br />Forum Added<br /><br /><blockquote><em>gena.txt</em><br />Egypt,Malaysia,Congo,Japan</blockquote><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Country From Forum<br />C) Remove All Countries From A Forum<br />D) Remove All Countries From All Forums<br />E) Main Menu<br /><br />------------------------<br />Choice: b<br /><-- Remove Country -- ><br />Forum Name: ga<br />Country Name: malaysia<br />Country Successfully Removed<br /><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Country From Forum<br />C) Remove All Countries From A Forum<br />D) Remove All Countries From All Forums<br />E) Main Menu<br /><br />------------------------<br />Choice: a<br /><br /><-- Add Forum List -- ><br />This program can read CSV files containing country lists.<br />The file must be formatted as (CountryOne,CountryTwo,CountryThree).<br />You may either write the entire address of the file below, or drag the file into the console and press enter.<br />-----------------------<br />Forum Name: ga<br />List Location: gena.txt<br />Egypt was not added because it already exists.<br />Congo was not added because it already exists.<br />Japan was not added because it already exists.<br />Forum Added<br /><br /><br /><em>Note:<br />The previous output display shows me adding a list of four countries into a forum, then deleting one of them, then trying to add the whole list again. When attempting to add the whole list again, only the one country that was previously deleted gets added again.</em><br /><br /><strong>The Code:</strong><br />The director class was changed, and a new Random Access File controller class was created. All code will be turned in during class since the program is due this week.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-114161839811527047?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0tag:blogger.com,1999:blog-21034237.post-1140366186251885302006-02-19T08:12:00.000-08:002006-02-19T08:23:06.273-08:00Week Four Review<strong>Objectives Set For This Week:</strong><br />Continue and finish the assignCountries method (the method should now be able to read in the country choices for each student and run through the assignment process, and create reports indicating the results of the assignment process.<br /><br /><strong>What Has Been Achieved:</strong><br />All goals have been achieved for this week. The assignment method has been completed and works effectively. The program now loads all the available countries and compares the student's choices to what is available. It assigns the students to countries that are in their best interest (highest choice). The program creates three reports after the assignment process is completed: Country Assignment Report, Students without countries report, and a Students without country choices report. The reports are created in .csv format so they can be opened in excel and printed and posted.<br /><br /><strong>Grade:</strong><br />Since all objectives have been achieved, I think i deserve a 20/20.<br /><br /><strong>Running Code:</strong><br /><blockquote><em>users.txt</em><br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />John,Mark,0,9,1,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Bobby,Jones,0,10,2,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Mark,Jacobs,0,10,3,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Ken,Stevens,0,12,3,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Jack,Black,0,12,3,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Steve,Jones,0,9,2,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Stevie,Wonder,0,9,3,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Toby,Hill,0,9,2,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,Malaysia,Egypt,Congo,GA,SC,ECOSOC,ICJ<br />Max,Johnson,0,11,4,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,Jamaica,GA,SC,ECOSOC,ICJ<br />Tom,Bill,0,11,2<br />Karim,El Gamal,0,11,0<br />Ibrahim,Damlaj,0,11,0<br />Heinz,Pabst,0,11,0</blockquote><br /><br /><blockquote><em>forum.txt</em><br />GA,Egypt,Congo,Malaysia<br />SC,Egypt,Congo,Malaysia<br />ECOSOC,Egypt,Congo,Malaysia<br />ICJ,Egypt,Congo,Malaysia</blockquote><br /><br /> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: lamia<br />Last Name: mazhar<br />Login Status: Director<br /><br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Assign Countries<br />D) Logout<br /><br />-------------------<br />Choice: c<br /><br /><br /><-- Assign Countries --><br /><br />A) Begin Process<br />B) Main Menu<br /><br />--------------------------<br />Choice: a<br />Students Sorted...<br />Assigning Countries...<br />Countries Assigned...<br />Making Reports...<br />Assignment Report Created! Filename: assignmentReport.csv<br />No Matches Report Created! Filename: noMatchReport.csv<br />No Choices Report Created! Filename: noChoiceReport.csv<br />Process Completed Successfully!<br /><br /><br /><-- Assign Countries --><br /><br />A) Begin Process<br />B) Main Menu<br /><br />--------------------------<br />Choice: b<br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Assign Countries<br />D) Logout<br /><br />-------------------<br />Choice: d<br /><br />Good-bye<br /><br /><blockquote><strong>Assignment Report</strong><br />First Name, Last Name, Forum, Country<br />Ken,Stevens,GA,Egypt<br />Jack,Black,GA,Congo<br />Tarek,Fahmy,GA,Malaysia<br />Mark,Jacobs,SC,Egypt<br />Bobby,Jones,SC,Congo<br />Stevie,Wonder,SC,Malaysia<br />Steve,Jones,ECOSOC,Egypt<br />Toby,Hill,ECOSOC,Congo<br />John,Mark,ECOSOC,Malaysia</blockquote><br /><br /><blockquote><strong>Students With No Assignments Report</strong><br />First Name, Last Name<br />Max,Johnson</blockquote><br /><br /><blockquote><strong>Students With No Choices Report</strong><br />First Name, Last Name<br />Tom,Bill<br />Karim,El Gamal<br />Ibrahim,Damlaj<br />Heinz,Pabst</blockquote><br /><br /><strong>Important Note:</strong><br />In the user.txt file, student data is listed, then their three choices for GA, ECOSOC and SC, then their two choices for ICJ, then the forums are listed in the student's preference order. The forum.txt file has the forum name, followed by the countries available in the forum.<br /><br /><strong>The Code:</strong><br />The List Controller class was modified a lot this week to go through with the assignment of the countries. All the methods were overhauled to account for the country choices of the students, and several methods added to assist in the assignment and to create reports. There was very little change in the director class. The actual code will be handed in seperately.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-114036618625188530?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com1tag:blogger.com,1999:blog-21034237.post-1139682656536386622006-02-11T10:23:00.000-08:002006-02-11T10:30:56.546-08:00Week Three Review<strong>Objectives Set For This Week:</strong><br />Begin work on the assignCountries method (the method should be able to read in the students from the file, sort the students into the three linked lists, sort the linked lists based on experience and print the linked list to screen)<br /><br /><strong>What Has Been Achieved:</strong><br />All goals have been achieved. The assignCountries method has been created and it links to the "ListController" class which loads all the students from the user database and seperates them into linked lists depending on their grade level. Within the grade level linked lists, the students are sorted according to years of experience. Students with the same experience are placed in the order that they appear in the file. Instead of doing only three linked lists (Seniors, Juniors and Sophomores), a fourth linked list for freshmen has been added to add more flexibility to the program allowing it to accept a ninth grader that has possibly come from another school with MUN experience. <br /><br /><strong>Grade:</strong><br />Since all objectives have been achieved, I think i deserve a 20/20.<br /><br /><strong>Running Code:</strong><br /><br /><blockquote><em>users.txt</em><br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2<br />John,Mark,0,9,1<br />Bobby,Jones,0,10,2<br />Mark,Jacobs,0,10,3<br />Ken,Stevens,0,12,3<br />Jack,Black,0,12,3<br />Steve,Jones,0,9,2<br />Stevie,Wonder,0,9,3<br />Toby,Hill,0,9,2</blockquote><br /><br /> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: lamia<br />Last Name: mazhar<br />Login Status: Director<br /><br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice: d<br /><br /><br /><-- Assign Countries --><br /><br />A) Begin Process<br />B) Main Menu<br /><br />--------------------------<br />Choice: a<br /><br />Linked Lists:<br />Seniors: Ken Stevens(3), Jack Black(3), <br />Juniors: Tarek Fahmy(2), <br />Sophomores: Mark Jacobs(3), Bobby Jones(2), <br />Freshmen: Stevie Wonder(3), Steve Jones(2), Toby Hill(2), John Mark(1), <br /><br /><-- Assign Countries --><br /><br />A) Begin Process<br />B) Main Menu<br /><br />--------------------------<br />Choice: B<br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice: E<br /><br />Good-bye<br /><br /><strong>The Code:</strong><br />The director class was modified to be able to start the assignment process. Several new classes have been created to carry out the linked list operations and seperations. The actual code will be handed in seperately<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113968265653638662?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com3tag:blogger.com,1999:blog-21034237.post-1139169350807469992006-02-05T11:52:00.000-08:002006-02-05T11:55:50.810-08:00Mastery Factors<strong>Polymorphism:</strong> Upon logging in, the program will declare an instance of the class User. User will have two subclasses: Student and Director. The program will determine whether the user is a student or a director, and when the getMenu() method is called, it will retrieve it from the correct subclass rather than the class User.<br /><br /><strong>Encapsulation:</strong> The class User has variables such as Name and Grade Level, which are declared as private variables. There will be methods such as setName() which will control the data flow to and from the variable Name. <br /><br /><strong>Inheritance:</strong> The sub-classes student and director inherit the variables and methods for the name and grade level. When the user calls the method getName() from the class Student, it gets it from the super class User.<br /><br /><strong>Standard Level Factors:</strong><br /> File I/O: The program will read the registered users from a file when the user is attempting to login.<br /> Simple Selection: The program checks if the username and password match the data being read from the registered users file.<br /> Loops: The program will loop the login script if the login fails. If the login is successful then the loop is broken.<br /> Complex Selection: There is a nested if statement in the login script, so if it is successful that the username and password matched a registered user, it also checks if they are a student or a director.<br /> User Defined Method: The login script is a user defined method which returns a 0 if the login was successful and the user was a student, 1 if the login was successful and the user was a director and finally a 2 if the login failed.<br /><br /><strong>ADT (Linked List) – (1st, 2nd, 3rd aspect):</strong> The students name, grade level, years of experience and RandomAccessFile location are stored into a linked list. There will be methods to add and delete students from the beginning, end and middle of the list when it is being sorted and separated into 3rd, 2nd and 1st year students. The program will do an error check afterwards to make sure that there are no breaks in the list and that the list will not overflow when traversed.<br /><br /><strong>Recursion:</strong> The program will recursively go through a linked list of students and separate them into three linked lists. One linked list will be 1st year, one will be 2nd year and the last will be 3rd year MUN students.<br /><br /><strong>Merging Lists:</strong> The lists of country assigned 1st year, 2nd year, and third year students are merged into one big list which will then be written to a file.<br /><br /><strong>Random Access File (Add):</strong> The students are stored in a file, which can be randomly accessed, and have student country choices added to the student without searching for the student’s position in the file every time.<br /><br /><strong>Random Access File (Delete):</strong> The program can randomly access the file where students choices are stored, and country choices can be deleted and/or changed if the student changes their mind about the countries and forums they want.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113916935080746999?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0tag:blogger.com,1999:blog-21034237.post-1139167636689816462006-02-05T11:18:00.000-08:002006-02-05T11:57:02.413-08:00Week Two Review<strong>Objectives Set For This Week:</strong><br />Develop the addStudent, deleteStudent, addForum, and deleteForum method for the director menu, and the logout method for both the director and the student menu. Develop the countryChoice method for the student menu (This student should be able to make all the country and forum choices, and the choices are written to a file).<br /><br /><strong>What Has Been Achieved:</strong><br />All goals have been achieved. The student management and forum management modules have been completed and have gained some new functions such as "Delete all students" or "Delete all forums". The logout method is simple and complete. The country choice method has been completed but needs to be made a bit more user friendly. It will be fixed up in the last week which was planned to be for final touches.<br /><br /><strong>Grade:</strong><br />Since all objectives have been achieved, I think i deserve a 20/20.<br /><br /><strong>Running Code:</strong><br /><br /><blockquote><em>forum.txt</em><br />GA<br />SC<br />ECOSOC<br />ICJ</blockquote><br /><br /> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: Lamia<br />Last Name: Mazhar<br />Login Status: Director<br /><br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice: B<br /><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Forum<br />C) Remove All Forums<br />D) Main Menu<br /><br />------------------------<br />Choice: A<br /><br /><-- New Student List -- ><br />This program can read CSV files containing country lists.<br />The file must be formatted as (CountryOne,CountryTwo,CountryThree).<br />You may either write the entire address of the file below, or drag the file into the console and press enter.<br />-------------------------<br />Forum Name: GA<br />List Location: ga.txt<br />This forum already exists. Proceed with replacing it (Y/N)? y<br />GA,Egypt,Congo,Malaysia<br />SC<br />ECOSOC<br />ICJ<br />Forum Added<br /><br /><blockquote><em>ga.txt</em><br />Egypt,Congo,Malaysia<br /></blockquote><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Forum<br />C) Remove All Forums<br />D) Main Menu<br /><br />------------------------<br />Choice: B<br /><br /><-- Forum to Remove -- ><br />Forum Name: ECOSOC<br />--------------------------<br />Are you sure you want to remove ECOSOC(Y/N)? y<br />Forum Removed<br /><br /><blockquote><em>forum.txt</em><br />GA,Egypt,Congo,Malaysia<br />SC<br />ICJ</blockquote><br /><br /><-- Forum Management --><br /><br />A) Add Forum Data From File<br />B) Remove Forum<br />C) Remove All Forums<br />D) Main Menu<br /><br />------------------------<br />Choice: D<br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice: A<br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2</blockquote><br /><br /><-- Student Management --><br /><br />A) Add Individual Student<br />B) Add List of Students<br />C) Remove Student<br />D) Remove All Students<br />E) Main Menu<br /><br />--------------------------<br />Choice: A<br /><br /><-- New Student Information -- ><br />First Name: New<br />Last Name: Student<br />Grade Level: 13<br />Years of Experience: 4<br /><br />**** Error in Entry<br />**** The grade level must be a number and be between 9 and 12.<br /><br />Re-Enter Grade Level: 12<br /><br />Student Added Successfully!<br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2<br />New,Student,0,12,4</blockquote><br /><br /><-- Student Management --><br /><br />A) Add Individual Student<br />B) Add List of Students<br />C) Remove Student<br />D) Remove All Students<br />E) Main Menu<br /><br />--------------------------<br />Choice: c<br /><br /><-- Student to Remove -- ><br />First Name: new<br />Last Name: student<br />--------------------------<br />Are you sure you want to remove new student(Y/N)?y<br />Student Removed<br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2<br /></blockquote><br /><br /><-- Student Management --><br /><br />A) Add Individual Student<br />B) Add List of Students<br />C) Remove Student<br />D) Remove All Students<br />E) Main Menu<br /><br />--------------------------<br />Choice: B<br /><br /><-- New Student List -- ><br />This program can read CSV files containing student data.<br />The file must be formatted as (First Name,Last Name,Grade Level,Years of Experience).<br />You may either write the entire address of the file below, or drag the file into the console and press enter.<br />-------------------------<br />List Location: newU.txt<br /><br />5 users successfully added.<br />Users not added because they already exist:<br />None<br /><br /><blockquote>newU.txt<br />Test,test,11,11<br />Test1,test,11,11<br />Test2,test,11,11<br />Test3,test,11,11<br />Test4,test,11,11</blockquote><br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2<br />Test,test,0,11,11<br />Test1,test,0,11,11<br />Test2,test,0,11,11<br />Test3,test,0,11,11<br />Test4,test,0,11,11</blockquote><br /><br /><-- Student Management --><br /><br />A) Add Individual Student<br />B) Add List of Students<br />C) Remove Student<br />D) Remove All Students<br />E) Main Menu<br /><br />--------------------------<br />Choice: E<br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice: E<br /><br />Good-bye<br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2</blockquote><br /><br /> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: Tarek<br />Last Name: Fahmy<br />Login Status: Student<br /><br /><------ Menu -----><br /><br />A) Make Country/Forum Choices<br />B) Logout<br /><br />-------------------<br />Choice: A<br />Here is where you enter all your country choices. You can only do this once so pick wisely<br /><br />GA Country #1: Egypt<br />GA Country #2: Ghana<br />GA Country #3: Cameroon<br />SC Country #1: Russia<br />SC Country #2: USA<br />SC Country #3: UK<br />ICJ Choice (Advocate/Justice) #1: Advocate<br />ICJ Choice (Advocate/Justcie) #2: Justice<br />ECOSOC Country #1: Saudi Arabia<br />ECOSOC Country #2: Russia<br />ECOSOC Country #3: USA<br />Country choices saved.<br /><------ Menu -----><br /><br />A) Make Country/Forum Choices<br />B) Logout<br /><br />-------------------<br />Choice: B<br /><br />Good-bye<br /><br /><blockquote>users.txt<br />Keir,Paesel,1,0,0<br />Lamia,Mazhar,1,0,0<br />Tarek,Fahmy,0,11,2,GA,Egypt,Ghana,Cameroon,SC,Russia,USA,UK,ICJ,Advocate,Justice,ECOSOC,Saudi Arabia,Russia,USA</blockquote><br /><br /><strong>The Code:</strong><br />I couldn't find a way to attach code to this blog, so I put up a zip file of all my code on a free webserver I use, which you can download using the following link:<br /><br />http://savingafrica.netfirms.com/DRM/weektwo.zip<br />(Copy link and paste it in the address bar)<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113916763668981646?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com2tag:blogger.com,1999:blog-21034237.post-1138595942094128122006-01-29T20:11:00.000-08:002006-01-29T20:40:24.493-08:00Week One Review- All goals set for the first week have been achieved. The program successfully identifies users as directors, or students using a login method. The login method works with a csv file to identify the user, and outputs a "critical error" if the userlist file is not found. The menu's have been created for both users, and they are called using polymorphism. The FileWriter class has been started, and a shell of it has been completed. The actual values of each record length needs to be calculated still. <br /><br /><strong>- Mastery factors already achieved:</strong><br />Inheritence<br />Polymorphism<br />Five SL Factors<br /><br /><strong>- Code:</strong><br /><br />##(Login Class)##<br /><br /><blockquote>import java.io.*;<br />import java.util.*;<br /><br />public class login<br />{<br /> public int loginUser(String username, String password) throws IOException<br /> { <br /> try<br /> {<br /> BufferedReader userList = new BufferedReader(new FileReader("users.txt"));<br /> StringTokenizer tokenizer;<br /> String temp = userList.readLine();<br /> <br /> while(temp != null){<br /> tokenizer = new StringTokenizer(temp, ",");<br /> if(username.toUpperCase().equals(tokenizer.nextToken().toUpperCase()) && password.toUpperCase().equals(tokenizer.nextToken().toUpperCase())){<br /> if(tokenizer.nextToken().equals("0")){<br /> return 0;<br /> }<br /> else{<br /> return 1;<br /> }<br /> }<br /> else{<br /> temp = userList.readLine();<br /> }<br /> }<br /> return 2;<br /> }<br /> catch(FileNotFoundException e)<br /> {<br /> System.out.println();<br /> System.out.println("Critical Error:");<br /> System.out.println("Problem: Userlist not found");<br /> System.out.println("Problem description: The program cannot find a crucial file needed for logging in. Please contact one of the MUN directors to fix the problem.");<br /> System.out.println("Program Exiting...");<br /> System.out.println();<br /> System.exit(0);<br /> }<br /> return 0;<br /> }<br />}</blockquote><br />##(Main Program Class)##<br /><br /><blockquote>import java.io.*;<br /><br />public class program<br />{<br /> static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));<br /><br /> public static void main(String[] args) throws IOException<br /> {<br /> String firstName, lastName, clear = "\033c";<br /> User newUser = null;<br /> boolean breakCommand = false;<br /> <br /> System.out.print(clear);<br /> System.out.println(" MUN Country Signup ");<br /> System.out.println(" Created by: Tarek Fahmy ");<br /> System.out.println("-----------------------------");<br /> System.out.println();<br /> <br /> while(breakCommand != true){<br /> System.out.println("------------ Login -----------");<br /> System.out.print("First Name: ");<br /> firstName = keyboard.readLine();<br /> System.out.print("Last Name: ");<br /> lastName = keyboard.readLine();<br /> <br /> login userLogin = new login();<br /> <br /> switch(userLogin.loginUser(firstName, lastName)){<br /> case 0:<br /> newUser = new Student();<br /> newUser.setName(firstName, lastName);<br /> System.out.println("Login Status: Student");<br /> System.out.println();<br /> breakCommand = true;<br /> break;<br /> case 1:<br /> newUser = new Director();<br /> newUser.setName(firstName, lastName);<br /> breakCommand = true;<br /> System.out.println("Login Status: Director");<br /> System.out.println();<br /> break;<br /> case 2:<br /> System.out.println("Login Failed! Please check your username and password");<br /> System.out.println();<br /> break;<br /> }<br /> }<br /> newUser.menu();<br /> }<br />}</blockquote><br />##(User Class)##<br /><br /><blockquote>import java.io.*;<br /><br />public abstract class User <br />{<br /> private String name;<br /><br /> public void menu() throws IOException<br /> {<br /> }<br /> public void setName(String fName, String lName)<br /> {<br /> name = fName + " " + lName;<br /> }<br />}</blockquote><br />##(Director Class)##<br /><br /><blockquote>public class Director extends User<br />{<br /> public void menu()<br /> {<br /> System.out.println("<------ Menu ----->");<br /> System.out.println();<br /> System.out.println("A) Student Management");<br /> System.out.println("B) Forum Management");<br /> System.out.println("C) Reports");<br /> System.out.println("D) Assign Countries");<br /> System.out.println("E) Logout");<br /> System.out.println();<br /> System.out.println("-------------------");<br /> System.out.print("Choice: ");<br /><br /> }<br />}</blockquote><br />- Other classes created include the Student class and the FileWriter class shell. I was not sure whether I should post those as well since the student class is very similar to the director, and the FileWriter class is only a shell. If you want me to post them, let me know and I will put them up in a second post.<br /><br /><strong>- Running Code:</strong><br /><br />##(Login As Student)##<br /><br /><blockquote> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: Tarek<br />Last Name: Fahmy<br />Login Status: Student<br /><br /><------ Menu -----><br /><br />A) Make Country/Forum Choices<br />B) Logout<br /><br />-------------------<br />Choice: </blockquote><br /><br />##(Login As Director)##<br /><br /><blockquote> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: Keir<br />Last Name: Paesel<br />Login Status: Director<br /><br /><------ Menu -----><br /><br />A) Student Management<br />B) Forum Management<br />C) Reports<br />D) Assign Countries<br />E) Logout<br /><br />-------------------<br />Choice:</blockquote> <br /><br />##(Failed Login)##<br /><br /><blockquote> MUN Country Signup <br /> Created by: Tarek Fahmy <br />-----------------------------<br /><br />------------ Login -----------<br />First Name: Jack<br />Last Name: Black<br />Login Failed! Please check your username and password<br /><br />------------ Login -----------<br />First Name:</blockquote><br /><br /><strong>- Grade:</strong><br />Since all goals have been achieved and the program is free from bugs at the moment, I think my achievement grade for the week is a 10/10.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113859594209412812?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0tag:blogger.com,1999:blog-21034237.post-1137927507379734432006-01-22T02:44:00.000-08:002006-01-28T20:47:40.930-08:00Progress Report: January 22, 2006What has been completed:<br /><br />- Login code works well and identifies the user as a student or a director. If the user is not identifiable, an error message is displayed indicating that there is something wrong with either the username or the password.<br /><br />- The director menu and the student menus have been completed and are displayed when the user is identified.<br /><br />- The login code works off of a csv file with the student database and can report an error message if the file is not found. The error message tells the user that the file is not found and that the user should report the problem to the MUN director.<br /><br />Problems encountered:<br /><br />- I would like to be able to clear the screen during certain stages of the program, however i don't know how to do it. There isn't a system.clear() function, or something similar. I overcame this problem with last year's hangman program, and I will try to find it and see how I had cleared the screen.<br /><br />What still needs to be done:<br /><br />- Bug fixing and some basic class structure setup (ie make the basic structure for the FileWriter class)<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113792750737973443?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0tag:blogger.com,1999:blog-21034237.post-1137396651915912382006-01-15T23:22:00.000-08:002006-01-15T23:30:51.923-08:00Criterion CWhat will be done to meet the following requirements:<br /><br />- C1 (Using good programming style): <br />Use proper indentation, spacing between common blocks of code and proper variable naming (using names that are obvious and haven't been used before).<br /><br />- C2 (Usability):<br />All the menus will be clear and obvious. Everytime the user starts a new function/method the instructions on what to do are stated beforehand so the user isn't confused. Sample data entry is shown when the user is asked to enter data, so that they know in what form the data should be entered.<br /><br />-C3 (Handling Errors)<br />The program will alert the user whenever they enter an incorrect data type or the program is opening up a file or record that doesn't exist. The errors that are given are detailed so the user knows exactly what is wrong, and clearly identifies how to fix the problem. <br /><br />All of these will be fully documented in the dossier using examples and program excerpts. The documentation will also show how these user-friendly functions help the program achieve the objectives in Criterion A2.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113739665191591238?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0tag:blogger.com,1999:blog-21034237.post-1137394964059158832006-01-15T22:42:00.000-08:002006-01-28T20:44:14.956-08:00Programming CalendarProgramming Schedule:<br /><br />- January 26: Create login and menus (the login should identify the user as a director or student and display the appropriate menu).<br /><br />- February 2: Develop the addStudent, deleteStudent, addForum, and deleteForum method for the director menu, and the logout method for both the director and the student menu. Develop the countryChoice method for the student menu (This student should be able to make all the country and forum choices, and the choices are written to a file).<br /><br />- February 9: Begin work on the assignCountries method (the method should be able to read in the students from the file, sort the students into the three linked lists, sort the linked lists based on experience and print the linked list to screen)<br /><br />- February 16: Continue and finish the assignCountries method (the method should now be able to read in the country choices for each student and run through the assignment process, and create reports indicating the results of the assignment process. <br /><br />- February 23: Last touches and error checking. <b>Program Due</b><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21034237-113739496405915883?l=tarekf.blogspot.com'/></div>Tarek Fahmyhttp://www.blogger.com/profile/10095454463775081645noreply@blogger.com0