Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
(Java) Database Organizer and Search (Mainly for practice)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="TomorrowIsAMystery" data-source="post: 297800" data-attributes="member: 51085"><p>Hey, so I've decided to release a project I completed which was a school database system. It allows you to search a student using binary search, count average marks, find out last names, first names, etc of any excel document. I've included two excel documents, one has 1000 fields filled out with last name, first name, student mark, course average etc. It also lets you update and save fields, as a new excel document or override the existing one.</p><p></p><p>The main purpose is for java student to read the code and detailed comments and to mess around with it and add their own flare. Also if you would like, make it an exceutable and run it in cmd or even make an applet out of it. Go nuts, even aspiring coders should take a read for shits and giggles on notepad.</p><p></p><p>anyways heres the link</p><p><a href="http://sharefa.st/view/aiqupoV0G0d1" target="_blank">http://sharefa.st/view/aiqupoV0G0d1</a></p><p></p><p>and heres an example of the code: </p><p></p><p>[CODE] public static boolean menu() throws IOException {</p><p> //THIS MENU PROMPTS ALLOWS YOU TO WORK WITH THE FILE AND READ AND WRITE SPECIFIC DATA</p><p> Scanner userInput = new Scanner(System.in); //SCANNER FOR THE USERS INPUT</p><p> do { //DO LOOP FOR AN EXECUTE FOR A GIVEN NUMBER OF TIMES (NUMBER OF TIMES DECLARED BY WHILE SOMETHING)</p><p> choice = "";</p><p> System.out.println("============================================="); //MENU OPTIONS (THEY ARE LOOPED TO BE DONE INDEFINATLY)</p><p> System.out.println("Type R To Read Another File");</p><p> System.out.println("Type L To Print all File Records");</p><p> System.out.println("Type AA To Print The Average Of All The Marks");</p><p> System.out.println("Type AC To Print Marks For a Specific Course");</p><p> System.out.println("Type NM To Change a Students Mark");</p><p> System.out.println("Type X To Exit The Program");</p><p> choice = userInput.nextLine(); //READS THE USERS CHOICE FOR WHAT THEY WANT TO DO WITH THE FILE</p><p> if (choice.equalsIgnoreCase("L")) { //IF THE CHOICE WAS THE LETTER L THEN RUN METHOD BELOW IT (SO IT CALLS THAT METHOD AND THAT METHOD IS RUN)</p><p> printList();</p><p> } else if (choice.equalsIgnoreCase("R")) {</p><p> fileChange();</p><p> } else if (choice.equalsIgnoreCase("AA")) {</p><p> average();</p><p> } else if (choice.equalsIgnoreCase("X")) {</p><p> exit();</p><p> } else if (choice.equalsIgnoreCase("AC")) {</p><p> courseAverage();</p><p> } else if (choice.equalsIgnoreCase("NM")) {</p><p> newMark();</p><p> } else if (choice.equalsIgnoreCase("RM")) {</p><p> } else {</p><p> System.err.println("Unknown Key Try Again..."); //IF THE USER INPUT WAS NONE OF THESE CHOICES THEN THROW THEM A NOTICE</p><p> }</p><p> } while (!choice.equalsIgnoreCase("x")); //DO WHILE THE CHOICE IS NOT X WHICH EXITS THE PROGRAM</p><p> return false;</p><p> }</p><p></p><p> public static void fileChange() throws IOException { //FILE CHANGE METHOD READS ANOTHER FILE THAT IS ASKED BY THE USER</p><p> readFile(user); //CALLS THE READFILE METHOD IN ORDER TO READ THAT FILE AND RUN IT PROPERLY AND IT READS THE FILE PROMPTED BY THE USER</p><p> }</p><p></p><p> public static void printList() { //PRINTS OUT ALL THE FIELDS OF DATA FOR EVERY STUDENT</p><p> for (int i = 0; i < numstu; i++) { //FROM 0 TO THE END OF THE FIELDS IN THE FILE</p><p> System.out.println(stu[i].toString()); //PRINT OUT THE REQUESTED CLASS</p><p> }</p><p> }</p><p></p><p> public static void average() { //AN AVERAGE CALCULATOR FOR THE ENTIRE STUDENT BODY</p><p> for (int i = 0; i < numstu; i++) { //FOR LOOP TO READ EVERY STUDENT RECORD</p><p> average += stu[i].mark; // keep adding to average //FOR EVERY RECORD ADD THE MARK OF THAT RECORD TO THE VARIABLE AVERAGE</p><p> }</p><p> // dividision by zero protection</p><p> if (choice.equalsIgnoreCase("AA") && numstu > 0) {</p><p> average = average / numstu; // compute the average. Always use the size in terms of a variable whenever possible.</p><p> System.out.println(average); // as noted below, if this is an integer value, < #of students computations will eval to 0.</p><p> } else if (!choice.equalsIgnoreCase("AA") && numstu < 0) { //IF THE MARK IS LESS THEN 0 THEN THERE MUST BE A PROBLEM</p><p> System.out.println("Oops! No Marks To Calculate!"); //PRINT OUT A NOTICE OF THE ISSUE</p><p> }</p><p> }</p><p> //THIS METHOD CALCULATES THE AVERAGE FOR A SPECIFIED COURSE</p><p></p><p> public static void courseAverage() {</p><p> System.out.println("Please Type In The Class Course Code"); //PROMPTS USER TO SELECT A COURSE TO CALCULATE</p><p> int markAdder = 0; //COUNTER FOR THE MARKS (IT ADDS UP)</p><p> int counter = 0; //COUNTER FOR THE AMOUNT OF STUDENTS IN THAT COURSE</p><p> int finalAverage; //FINALAVERAGE CALCULATOR</p><p> String choicer; //USERINPUT CHOICE</p><p> Scanner reader = new Scanner(System.in); //SCANNER FOR WHAT THE USER TYPES</p><p> choicer = reader.nextLine(); //WHATEVER THE USER TYPED IS STORED IN THE VARIABLE CHOICER</p><p> for (int i = 0; i < numstu; i++) { //FOR LOOP EVERY SINGLE FIELD IN THE FILE</p><p> if (stu[i].courseCode.equalsIgnoreCase(choicer)) { //IF THE COURSECODE EQUALS TO WHAT THE USER TYPES THEN...</p><p> markAdder += stu[i].mark; //GO TO THAT STUDENTS MARK AND ADD IT TO THE MARKADDER VARIABLE</p><p> counter++; //THIS COUNTS THE AMOUNT OF STUDENTS IN THAT COURSE FOR THE FINAL CALCULATION</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="TomorrowIsAMystery, post: 297800, member: 51085"] Hey, so I've decided to release a project I completed which was a school database system. It allows you to search a student using binary search, count average marks, find out last names, first names, etc of any excel document. I've included two excel documents, one has 1000 fields filled out with last name, first name, student mark, course average etc. It also lets you update and save fields, as a new excel document or override the existing one. The main purpose is for java student to read the code and detailed comments and to mess around with it and add their own flare. Also if you would like, make it an exceutable and run it in cmd or even make an applet out of it. Go nuts, even aspiring coders should take a read for shits and giggles on notepad. anyways heres the link [url]http://sharefa.st/view/aiqupoV0G0d1[/url] and heres an example of the code: [CODE] public static boolean menu() throws IOException { //THIS MENU PROMPTS ALLOWS YOU TO WORK WITH THE FILE AND READ AND WRITE SPECIFIC DATA Scanner userInput = new Scanner(System.in); //SCANNER FOR THE USERS INPUT do { //DO LOOP FOR AN EXECUTE FOR A GIVEN NUMBER OF TIMES (NUMBER OF TIMES DECLARED BY WHILE SOMETHING) choice = ""; System.out.println("============================================="); //MENU OPTIONS (THEY ARE LOOPED TO BE DONE INDEFINATLY) System.out.println("Type R To Read Another File"); System.out.println("Type L To Print all File Records"); System.out.println("Type AA To Print The Average Of All The Marks"); System.out.println("Type AC To Print Marks For a Specific Course"); System.out.println("Type NM To Change a Students Mark"); System.out.println("Type X To Exit The Program"); choice = userInput.nextLine(); //READS THE USERS CHOICE FOR WHAT THEY WANT TO DO WITH THE FILE if (choice.equalsIgnoreCase("L")) { //IF THE CHOICE WAS THE LETTER L THEN RUN METHOD BELOW IT (SO IT CALLS THAT METHOD AND THAT METHOD IS RUN) printList(); } else if (choice.equalsIgnoreCase("R")) { fileChange(); } else if (choice.equalsIgnoreCase("AA")) { average(); } else if (choice.equalsIgnoreCase("X")) { exit(); } else if (choice.equalsIgnoreCase("AC")) { courseAverage(); } else if (choice.equalsIgnoreCase("NM")) { newMark(); } else if (choice.equalsIgnoreCase("RM")) { } else { System.err.println("Unknown Key Try Again..."); //IF THE USER INPUT WAS NONE OF THESE CHOICES THEN THROW THEM A NOTICE } } while (!choice.equalsIgnoreCase("x")); //DO WHILE THE CHOICE IS NOT X WHICH EXITS THE PROGRAM return false; } public static void fileChange() throws IOException { //FILE CHANGE METHOD READS ANOTHER FILE THAT IS ASKED BY THE USER readFile(user); //CALLS THE READFILE METHOD IN ORDER TO READ THAT FILE AND RUN IT PROPERLY AND IT READS THE FILE PROMPTED BY THE USER } public static void printList() { //PRINTS OUT ALL THE FIELDS OF DATA FOR EVERY STUDENT for (int i = 0; i < numstu; i++) { //FROM 0 TO THE END OF THE FIELDS IN THE FILE System.out.println(stu[i].toString()); //PRINT OUT THE REQUESTED CLASS } } public static void average() { //AN AVERAGE CALCULATOR FOR THE ENTIRE STUDENT BODY for (int i = 0; i < numstu; i++) { //FOR LOOP TO READ EVERY STUDENT RECORD average += stu[i].mark; // keep adding to average //FOR EVERY RECORD ADD THE MARK OF THAT RECORD TO THE VARIABLE AVERAGE } // dividision by zero protection if (choice.equalsIgnoreCase("AA") && numstu > 0) { average = average / numstu; // compute the average. Always use the size in terms of a variable whenever possible. System.out.println(average); // as noted below, if this is an integer value, < #of students computations will eval to 0. } else if (!choice.equalsIgnoreCase("AA") && numstu < 0) { //IF THE MARK IS LESS THEN 0 THEN THERE MUST BE A PROBLEM System.out.println("Oops! No Marks To Calculate!"); //PRINT OUT A NOTICE OF THE ISSUE } } //THIS METHOD CALCULATES THE AVERAGE FOR A SPECIFIED COURSE public static void courseAverage() { System.out.println("Please Type In The Class Course Code"); //PROMPTS USER TO SELECT A COURSE TO CALCULATE int markAdder = 0; //COUNTER FOR THE MARKS (IT ADDS UP) int counter = 0; //COUNTER FOR THE AMOUNT OF STUDENTS IN THAT COURSE int finalAverage; //FINALAVERAGE CALCULATOR String choicer; //USERINPUT CHOICE Scanner reader = new Scanner(System.in); //SCANNER FOR WHAT THE USER TYPES choicer = reader.nextLine(); //WHATEVER THE USER TYPED IS STORED IN THE VARIABLE CHOICER for (int i = 0; i < numstu; i++) { //FOR LOOP EVERY SINGLE FIELD IN THE FILE if (stu[i].courseCode.equalsIgnoreCase(choicer)) { //IF THE COURSECODE EQUALS TO WHAT THE USER TYPES THEN... markAdder += stu[i].mark; //GO TO THAT STUDENTS MARK AND ADD IT TO THE MARKADDER VARIABLE counter++; //THIS COUNTS THE AMOUNT OF STUDENTS IN THAT COURSE FOR THE FINAL CALCULATION } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
(Java) Database Organizer and Search (Mainly for practice)
Top