Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,150,587 members, 7,809,124 topics. Date: Friday, 26 April 2024 at 12:14 AM |
Nairaland Forum / Science/Technology / Programming / Java Code Improvement. (671 Views)
Please Help With Java Code For This Simple App.. / Need Assistance With A Java Code / Improve The Speed Of This Java Code. (2) (3) (4)
(1) (Reply)
Java Code Improvement. by Nobody: 6:34pm On Jan 18, 2013 |
Hello everyone. I'm learning Java (albeit, in University), and was tasked with writing some program which takes a file, and utilizes StringTokenizer, cleans it up and prints things back to the user, i.e., name, age, et al. So, the second bit of the task is to make routines maxAge(), minAge(), and avgAge(), all of which I've done shown here: http:///l1CnJ It's sloppy, and can certainly be done better, but I'm not sure how. Each class has methods, and the Person.java class has methods that are integrated into the constructors, i.e., Person.getAge(), and the maxAge() methods are done using static variables, I feel it can be done better and in a new class, accepting a List <Person> as an argument, but even that seems a bit sketchy. The next bit of the task is to make the routines faster, but I think I've done it all so badly that I may need to rewrite. Could anyone point me in the right direction? (Literally been programming in Java for less than a month.) |
Re: Java Code Improvement. by naijaswag1: 6:56pm On Jan 18, 2013 |
That link brings up nothing but a server not found on mozila firefox. Paste the code here on Nairaland. However,this is not an algorithmic challenge where you are concerned with the speed and efficiency of your code. Organize your code in an OOP oriented way and get the job done. |
Re: Java Code Improvement. by Nobody: 7:16pm On Jan 18, 2013 |
naija_swag: That link brings up nothing but a server not found on mozila firefox. Paste the code here on Nairaland. However,this is not an algorithmic challenge where you are concerned with the speed and efficiency of your code. Organize your code in an OOP oriented way and get the job done. It's quite a bit of code, separated by different source files. The one in question is Person.java package labs_one; I don't know how better to object orient it |
(1) (Reply)
Php / Data Base Management / You Need A Website? Get It Now, Pay Later!
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18 |