• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:43
CET 13:43
KST 21:43
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
Weekly Cups (Nov 3-9): Clem Conquers in Canada2SC: Evo Complete - Ranked Ladder OPEN ALPHA7StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Weekly Cups (Nov 3-9): Clem Conquers in Canada Mech is the composition that needs teleportation t Craziest Micro Moments Of All Time? RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Should offensive tower rushing be viable in RTS games? Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1892 users

My Java learning

Blogs > darkness
Post a Reply
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2011-12-11 07:14:19
December 11 2011 07:10 GMT
#1
I've recently made a thread asking for Java help (http://www.teamliquid.net/forum/viewmessage.php?topic_id=293245), and a few guys contacted me to help me. Thank you Chairman Ray, ClysmiC and chiboni!

On a different note, I'd like to share my rated assignments, but I'm not going to publish those which are submitted but not marked yet.

Assignment #1: 18/20
Short description: print my username
PDF: http://mediafire.com/?k89bobukrixa6oz
+ Show Spoiler +

http://pastebin.com/yQqsw5wZ

Flaws:
+ Show Spoiler +

- Poor identation
- The class name doesn't start with upper case
- The main method is on the bottom
Anything else I could improve?


Assignment #2: 20/20
Short description: calculating office costs
PDF: http://mediafire.com/?fkj4cccwx8m8c0d
+ Show Spoiler +

Application class: http://pastebin.com/u0msVR4D
Target class: http://pastebin.com/q1rARA2e

Flaws:
+ Show Spoiler +

Class names don't start with upper case
Anything else?


Assignment #3: 18/20
Short description: Finding 2 angles and 1 side (cosine formula) by getting 2 sides and 1 angle as input
PDF: http://mediafire.com/?sjr3kd9cccar5wi
+ Show Spoiler +

Application class: http://pastebin.com/fLxHKcVy
Target class: http://pastebin.com/AdKGnUs8

Flaws:
+ Show Spoiler +

Class names don't start with upper case
Anything else?


Assignment #4: 18/20
Short description: Quadrilateral recognition
PDF: http://mediafire.com/?vjf2jnvdgwfa91j
+ Show Spoiler +

Application class: http://pastebin.com/Nfxu5Kfb
Target class: http://pastebin.com/yQFAQxdA

Flaws:
+ Show Spoiler +

- Instead of using multiple IF's, boolean methods might have been better
- Wrong value checking might be bypassed by entering a bad value twice
Anything else I could improve?


Btw, which programming forum do you recommend? I don't visit any right now.

P.S. Sorry for English mistakes I may have made.

*****
hersenen
Profile Joined November 2011
Belize176 Posts
December 11 2011 07:16 GMT
#2
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.
brachester
Profile Blog Joined March 2011
Australia1786 Posts
December 11 2011 07:28 GMT
#3
^^^ i'm clueless when it come to programming, what are programming languanges???
I hate all this singing
Wry
Profile Joined October 2011
Canada25 Posts
December 11 2011 07:34 GMT
#4
I quickly looked at your assignment #4, and you don't handle your improper angle input correctly. The user can input an angle say 200, then 300 and it will allow it since you're not checking the second time. I see that you did do that for assignment 3 though.

As for programming forums, I don't particularly know any, I usually float around computer forums and sometimes it comes up. I'd be interested if you find one though.
SgtCoDFish
Profile Blog Joined July 2010
United Kingdom1520 Posts
Last Edited: 2011-12-11 08:35:21
December 11 2011 08:31 GMT
#5
I'm only going to talk about question 1 'cause I'm tired. For what it's worth, I'm entirely self-taught.

Your approach for question 1 is totally fine, and obviously works. But generally, whenever you see yourself calling the same function over and over again (in this case, the print function) there's usually a more elegant way to do it.

I'd recommend storing the big "letters" as arrays of strings, and then writing a general function to let you print an array of strings (and add an "\n" at the end).

This would change your main() to something like:
public static void main (String[] args) {
String U[] = {"...", "...", "..."}; // obviously you should put the actual stuff here, not "..."
// define all the other letters/numbers too.

printGiantLetter(U);
printGiantLetter(ONE);
printGiantLetter(B);
printGiantLetter(V);
printGiantLetter(B);
}


+ Show Spoiler +
This could be improved even further by having printGiantLetter accept multiple arguments so you only have one call to
printGiantLetters(U, 1, B, V, B);
(a way of making a repetition in code more elegant, again).


I'd implement printGiantLetter(String []) with a for or while loop that displays every element of the array and then prints an \n when the loop finishes.

The main advantages are:
1) If some reason to want to go back and use this project again in the future, you can easily add new letters/numbers/symbols and extend the program. Having a reusable extensible program is always nice.

2) (most important) Less scope for mistakes. If every character has its own function, that's a lot of functions to check. In this project, it'll always be pretty easy to pin down a mistake or a bug (say if "u" is displaying incorrectly, you know the problem is in the "u" function) but as you start to do much bigger stuff it won't always be that easy.

If you have just one display function, either all of it displays wrong or none of it. This means you only have one thing to troubleshoot.

This might seem incredibly pointless for this project (which is quite simple) but as I said, as you make bigger stuff you'll start to run into problems.

This is just a general tip though, and at the end of the day you still nailed it and got the marks, so it's all good

Disclaimer: I'm tired and probably not thinking entirely straight. Sorry if I made any mistakes with syntax or the coding.
WickedSkies
Profile Blog Joined August 2011
Netherlands81 Posts
December 11 2011 11:03 GMT
#6
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.

Mind I ask what are these other programming languages that can kinda of do better? Keep in mind that the fact you are considering PHP a programming language makes me have a certain opinion about your opinion. Next HTML and bash are programming languages.Good for you, sir, good for you.
Drone chasing probe, Tasteless quietly watching (Artosis)
Random()
Profile Blog Joined August 2004
Kyrgyz Republic1462 Posts
December 11 2011 11:46 GMT
#7
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.


This statement is so pointless :-) Java is one of the most widely used languages and enjoys the best IDE support out there. It is IMO a very good choice of language to learn imperative style programming.
WickedSkies
Profile Blog Joined August 2011
Netherlands81 Posts
December 11 2011 13:41 GMT
#8
On December 11 2011 20:46 Random() wrote:
Show nested quote +
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.


This statement is so pointless :-) Java is one of the most widely used languages and enjoys the best IDE support out there. It is IMO a very good choice of language to learn imperative style programming.

http://langpop.com/
shows an unbiased popularity distribution. In all charts, Java is in the top 3. I wonder why since there is no future in Java...
Drone chasing probe, Tasteless quietly watching (Artosis)
tofucake
Profile Blog Joined October 2009
Hyrule19151 Posts
Last Edited: 2011-12-11 14:01:48
December 11 2011 14:00 GMT
#9
On December 11 2011 20:03 WickedSkies wrote:
Show nested quote +
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.

Mind I ask what are these other programming languages that can kinda of do better? Keep in mind that the fact you are considering PHP a programming language makes me have a certain opinion about your opinion. Next HTML and bash are programming languages.Good for you, sir, good for you.

I'm sorry are you insulting the most widely used language on the internet? Comparing Java and PHP is pretty wrong anyway since they are for entirely different purposes.


On December 11 2011 22:41 WickedSkies wrote:
Show nested quote +
On December 11 2011 20:46 Random() wrote:
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.


This statement is so pointless :-) Java is one of the most widely used languages and enjoys the best IDE support out there. It is IMO a very good choice of language to learn imperative style programming.

http://langpop.com/
shows an unbiased popularity distribution. In all charts, Java is in the top 3. I wonder why since there is no future in Java...

Because it's taught in schools as it has some nice features that make it simpler to learn than C(++).
Liquipediaasante sana squash banana
Azzur
Profile Blog Joined July 2010
Australia6260 Posts
Last Edited: 2011-12-11 16:20:25
December 11 2011 16:19 GMT
#10
I'm an experienced Java programmer (7 years industry experience).

Java's greatest strength is it's support from Oracle - pretty much all of their products run on Java. In my opinion, Java will make or break depending on Oracle's strength. Java is a very powerful language with a fantastic API but it's weakness is that it has a steep learning curve. In addition, it's language is not standalone - for instance, if a beginner programmer wants to make a few web pages or java apps, it's actually quite hard since they need to use alot of frameworks. This makes it hard to attract new programmers into the market. Currently, I do alot of Oracle ADF work (which is essentially Oracle's implementation of the Java EE environment). ADF has a high learning curve but once mastered, you can churn out a lot of applications quite quickly and effectively.

I wish that I can have some experience in Microsoft products, e.g. .NET or C#. I don't think it'll have too much trouble adapting to it, but the problem is getting into the industry itself. I doubt anyone would pay me the equivalent for my 7 years experience when they can get a .NET programmer. Unless I want to take a paycut maybe. I heard that developing in their frameworks is quite fast.

C++ is highly used in the gaming industry because of the greater control over memory management. Although, I don't really like C++ that much. I think over the last couple of years, Java has taken great strides in improving itself in real-time applications. I think it's possible within 5 years that Java can provide time guarantees for real-time applications. I know that Java has a small presence in this market - but I don't think they are used for time-critical applications yet, merely time-sensitive ones.

As for other languages, definitely learn SQL for alot of business applications will definitely have a database. As for scripting languages like Javascript or PHP, they are gaining in popularity, but unfortunately, I don't have much exposure to them.
LastWish
Profile Blog Joined September 2004
2015 Posts
Last Edited: 2011-12-11 16:26:42
December 11 2011 16:25 GMT
#11
Just briefly:
#1:
I don't like you using '\n' in this example.
Though it's usually just stylistic thing I'd prefer using System.out.println() once more for that purpose.
You can implement a method printStar(char ch), then use switch to print the desired characters and throw exception on default.
Additionally you can then easily implement a function printStar(String str).
#2,#3,#4:
You could try making a function that encapsulates the input+validate routine. Something along the line getValidatedInput(question, type, validationFunction, errorMessage)...
Your target class may lazy load the values, since after initialization there is no way the values can change.
Also if you were reusing the results over and over again it would boost your performance.

In general I don't like that you are using '\n' at the beginning of the print('\nblablabla').
For example in #4 you could have used one print() before all the ifs and save your texts from starting with '\n'.
- It's all just treason - They bring me down with their lies - Don't know the reason - My life is fire and ice -
Azzur
Profile Blog Joined July 2010
Australia6260 Posts
Last Edited: 2011-12-11 16:39:18
December 11 2011 16:28 GMT
#12
Anyways, I was looking at your fourth program. You should additionally have the following things:

- Checking the inputs for consistency: for instance, what if I put -1 or 400 in the values? Even though you did have input checking in the main function, you really should do it in QRecognition. This is because, the main program could be written by different people (you can put this in your report as well). You can throw exceptions for invalid values.

- You have alot of logic done in the main function. In reality, everything should be self contained in the QRecognition class. If you wanted to put your logic in main, then you don't need the QRecognition class at all (which is what object orientation is not about).

- Think about it in this terms: you want to create a set of usable functions in QRecognition where another developer can call and use it effectively. The 2nd developer shouldn't need to do any special logic at all (they should read your API and know what to do). So, for instance, I would definitely have a function in QRecognition called determineObject() and put all your logic in it.

- Also in reality, what you probably want is a static method (although in reality, the tutors probably want you to do it the way you have), e.g.
public static String determineObject(int angleA, int angleB, int angleC) throws InvalidInputException;

- You access this in the main by QRecognition.determineObject(inputA, inputB, inputC);

- Btw, you can use System.out.println but that's a minor issue.

- Use javadoc to define the QRecognition class and its functions.
mmp
Profile Blog Joined April 2009
United States2130 Posts
December 11 2011 17:19 GMT
#13
Static analysis makes Java particularly reassuring for big projects where tiny mistakes can cost big $ or lots of lives. That doesn't mean that mistakes don't happen, but Java programmers feel safer...
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
December 11 2011 20:12 GMT
#14
Thanks for feedback guys. I know the 1st assignment is very mediocre, but that Java module is supposed to start everything from scratch, so no background knowledge is assumed (e.g. arrays).
Nizzy
Profile Blog Joined November 2010
United States839 Posts
December 12 2011 00:06 GMT
#15
ROFL. came on the forums browsing because I needed a break from my java final. It's probably like 60%-70% done, due in like 5 hours. I just don't care anymore, teacher is a tard. All instructions have always been wrong, I've out done most of the kids in the class. I'm probably locked up an A anyways. I wish you luck and I feel better that a fellow crafter also has a java course!!!


//PHASE IV OF IV
//---------------------------------------------------------------------------------------------------------------
package Phase;
// IMPORT COMMANDS
import javax.swing.JOptionPane;
import java.io.*;
import java.util.*;
// PHASE IV STARTS
public class phaseiv
{
//---------------------------------------------------------------------------------------------------------------
// STARTING OF MAIN METHOD
public static void main(String[] args)
{
// DECLARE MENU SELECTION VARIABLE
Integer intMENUSELECT;
// SETS PATIENT INFORMATION TO NEW PATIENT WHEN STARTING THE PATIENT PROGRAM
clsPAT_INFO PAT_MENU = new clsPAT_INFO();
PAT_MENU.voidSTARTPROG();
intMENUSELECT = PAT_MENU.intMAINMENU();
// START WHILE LOOP
while (intMENUSELECT <= 4)
{
if (intMENUSELECT == 1)
{
PAT_MENU.voidMOD_PAT (); // MODIFY PATIENT REQUEST OPTION 1
}
else if (intMENUSELECT == 2)
{
PAT_MENU.voidMOD_SUR (); // MODIFY SURGERY REQUEST OPTION 2
}
else if (intMENUSELECT == 3)
{
PAT_MENU.voidREPORT(); // REPORT REQUEST OPTION 3
}
else if (intMENUSELECT == 4)
{
PAT_MENU.voidEXIT_PROG(); // EXIT PROGRAM OPTION 4
}
intMENUSELECT = PAT_MENU.intMAINMENU();
} // WHILE LOOP FINISHED
// IF OPTION 4 IS NOT SELECTED WHEN EXITING THIS WILL CLOSE PATIENT & SURGERY DATA FILE
PAT_MENU.voidEXIT_PROG();
} // END OF MAIN PROGRAM METHOD
}
//---------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------
// CLASS OBJECT CONTAINER FOR PATIENT INFORMATION
class clsPAT_INFO
{
// DECLARE PATIENT INFORMATION VARIABLES
Integer intPAT_COUNT = -1, i;
// SET ARRAY VALUES OF 100
Integer [] intPAT_NUM = new Integer [100];
String [] strPAT_NAME = new String [100];
String [] strPAT_CITY = new String [100];
String [] strPAT_DOC = new String [100];
String [] strDATE_ADM = new String [100];
String [] strPAT_DIAG = new String [100];
// DECLARE SURGERY INFORMATION VARIABLES
Integer intSUR_COUNT = -1;
// SET ARRAY VALUES OF 100
Integer [] intSUR_NUM = new Integer [100];
Integer [] intPAT_SUR_NUM = new Integer [100];
String [] strSUR_DATE = new String [100];
String [] strSUR_LOC = new String [100];
Double[] dblSUR_COST = new Double [100];
//---------------------------------------------------------------------------------------------------------------
// START OF THE MAIN MENU GUI WINDOW
Integer intMAINMENU()
{
// DECLARE MAIN MENU VARIABLES
String strMENU_NUM;
Integer intMENU_NUM;
// MAIN MENU OUTPUT DISPLAY STRINGS
String strMENUSELECT =
"ACME Health System" + " \n " + " \n " +
"1. Add/Modify Patient Information" + " \n " +
"2. Add/Modify Surgery Information" + " \n " +
"3. Report Section" + " \n " +
"4. Exit Health System" + " \n " + " \n " +
"Please Make Your Selection >";
strMENU_NUM = JOptionPane.showInputDialog(null, strMENUSELECT, " ",
JOptionPane.QUESTION_MESSAGE);
intMENU_NUM = Integer.parseInt(strMENU_NUM);
// RETURN THE SELECTED MENU NUMBER OPTION
return intMENU_NUM;
} // END OF MAIN MENU GUI PROMPT METHOD
//---------------------------------------------------------------------------------------------------------------
// START OF THE START PROGRAM CODING
void voidSTARTPROG()
{
String strNEWLINE;
try
{
// DEFINE A FILE VARIABLE FOR BUFFERED READ
BufferedReader PAT_FILE = new BufferedReader(new FileReader("patient.dat"));
// READ LINES IN DAT FILE UNTIL NO MORE LINES IN FILE TO READ IN LOOP
while ((strNEWLINE = PAT_FILE.readLine()) != null)
{
// DAT FILE HAS "#" BETWEEN EACH DATA ITEM IN EACH LINE
StringTokenizer delimiter = new StringTokenizer(strNEWLINE,"#");
intPAT_COUNT = intPAT_COUNT+1;
intPAT_NUM[intPAT_COUNT] = Integer.parseInt(delimiter.nextToken());
strPAT_NAME[intPAT_COUNT] =delimiter.nextToken();
strPAT_CITY[intPAT_COUNT] =delimiter.nextToken();
strPAT_DOC[intPAT_COUNT] =delimiter.nextToken();
strDATE_ADM[intPAT_COUNT] =delimiter.nextToken();
strPAT_DIAG[intPAT_COUNT] =delimiter.nextToken();
} // END WHILE LOOP
// CLOSE PATIENT.DAT FILE
PAT_FILE.close();
//-----------------------------------------------
// DEFINE A FILE VARIABLE FOR BUFFERED READ
BufferedReader SUR_FILE = new BufferedReader(new FileReader("surgery.dat"));
// READ LINES IN DAT FILE UNTIL NO MORE LINES IN FILE TO READ IN LOOP
while ((strNEWLINE = SUR_FILE.readLine()) != null)
{
// DAT FILE HAS "#" BETWEEN EACH DATA ITEM IN EACH LINE
StringTokenizer delimiter = new StringTokenizer(strNEWLINE,"#");
intSUR_COUNT = intSUR_COUNT+1;
intSUR_NUM[intPAT_COUNT] = Integer.parseInt(delimiter.nextToken());
intPAT_SUR_NUM[intPAT_COUNT] = Integer.parseInt(delimiter.nextToken());
strSUR_DATE[intPAT_COUNT] =delimiter.nextToken();
strSUR_LOC[intPAT_COUNT] =delimiter.nextToken();
dblSUR_COST[intPAT_COUNT] = Double.parseDouble(delimiter.nextToken());
} // END WHILE LOOP
// CLOSE SURGERY.DAT FILE
SUR_FILE.close();
} // END TRY
catch (IOException error)
{
// IF CATCH THEN ERROR MESSAGE OUTPUT
System.out.println("Error On File Read " + error);
} // ERROR ON FILE READ
} // END OF THE START PROGRAM CODING
//---------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------
// OPTION 1 - MODIFY PATIENT
void voidMOD_PAT()
// DECLARE OPTION 1 VARIABLES
{
Integer intMOD_PAT_MENU = 0;
// START WHILE LOOP
while(intMOD_PAT_MENU != 4)
{
String strMOD_PAT_MENU = JOptionPane.showInputDialog(null,
"Please Select Modify Patient Option:" + " \n " + " \n " +
"1. Add Patient" + " \n " +
"2. Delete Patient" + " \n " +
"3. Modify Patient Information" + " \n " +" \n " +
"Please Make Your Selection >");
intMOD_PAT_MENU = Integer.parseInt(strMOD_PAT_MENU);
//-----------------------------------------------
// START IF STATEMENT MODIFY PATIENT OPTIONS MENU
if(intMOD_PAT_MENU == 1) // OPTION 1 ADD PATIENT TO .DAT FILE
// INPUT QUESTION MESSAGE PROMPTS FOR PATIENT INFORMATION DATA
{
// DECLARE VARIABLES FOR MODIFY PATIENT PROMPTS
String strVALUE, strOUTPUT;
intPAT_COUNT = intPAT_COUNT+1;
strOUTPUT = "Enter The Patient Number";
strVALUE =JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
intPAT_NUM[intPAT_COUNT]=Integer.parseInt(strVALUE);
strOUTPUT = "Enter the Patient Name";
strPAT_NAME[intPAT_COUNT] = JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
strOUTPUT = "Enter the City";
strPAT_CITY[intPAT_COUNT] = JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
strOUTPUT = "Enter the Doctor Name";
strPAT_DOC[intPAT_COUNT] = JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
strOUTPUT = "Enter the Date of Admission";
strDATE_ADM[intPAT_COUNT] = JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
strOUTPUT = "Enter the Diagnosis";
strPAT_DIAG[intPAT_COUNT] = JOptionPane.showInputDialog(null, strOUTPUT, "", JOptionPane.QUESTION_MESSAGE);
}
//-----------------------------------------------
else
if(intMOD_PAT_MENU == 2) // OPTION 2 DELETE PATIENT FROM .DAT FILE
{
// DECLARE PATIENT MENU DELETE OPTION VARIABLES
Integer intPAT_DEL_NUM = 0, intPATDELETE;
// DELETE PATIENT QUESTION PROMPT
intPATDELETE = Integer.parseInt(JOptionPane.showInputDialog(null,"Please Enter The Patient Number For Deletion",
"Delete Patient",JOptionPane.QUESTION_MESSAGE));

for(int i=0; i<=pcount; i++)
{
if(delete_id == number[i])
{
intPAT_DEL_NUM = i;
}
}
for(int i = intPAT_DEL_NUM; i<pcount;i++)
{
number[pcount] = number[pcount+1];
name[pcount] =name[pcount+1];
city[pcount] = city[pcount+1];
doctor[pcount] = doctor[pcount+1];
date[pcount] = date[pcount+1];
diagnosis[pcount] = diagnosis[pcount+1];
}
}
//-----------------------------------------------
else
if(intMOD_PAT_MENU == 3) // OPTION 3 MODIFY PATIENT INFORMATION FROM .DAT FILE
{
}
}
}

************edit me **************

//---------------------------------------------------------------------------------------------------------------
// OPTION 2 - MODIFY SURGERY
void voidMOD_SUR()
{
System.out.println("Modify_surgery has been executed");
}
//---------------------------------------------------------------------------------------------------------------
// OPTION 3 - REPORT SECTION
void voidREPORT()
{
// DECLARE OPTION 3 VARIABLES
String strQUERY1 = null;
String strQUERY2 = null;
Integer intREPSELECT = 0;
// START LOOP FOR REPORT SELECT MENU
while(intREPSELECT != 10)
{
String strREPSELECT = JOptionPane.showInputDialog(null,
"ACME Health System" + " \n " + " \n " +
"1. All Patient Info" + " \n " +
"2. All Patients Who Have A Specific Doctor" + " \n " +
"3. All Patients Who Have A Specific Diagnosis" + " \n " +
"4. All Patients Admitted Between Specific Dates" + " \n " +
"5. Report 5" + " \n " +
"6. Report 6" + " \n " +
"7. Report 7" + " \n " +
"8. Report 8" + " \n " +
"9. Report 9" + " \n " +
"10. Exit Report Menu" + " \n " +
" " + "\n" +
"Please Make Your Selection >");
intREPSELECT = Integer.parseInt(strREPSELECT);
//-----------------------------------------------
if(intREPSELECT == 1) // ALL PATIENT INFO
{
System.out.println("All Patient Information Listed In Order Of Entry: ");
for (i=0; i<intPAT_COUNT; ++i)
{
// LABEL AND PRINT STORED ARRAY VALUES FROM PATIENT DATA FILE
System.out.println(
"NUMBER: "+intPAT_NUM[i]+", NAME: "+strPAT_NAME[i]+", CITY: "+strPAT_CITY[i]+", " +
"DOCTOR: "+strPAT_DOC[i]+", DATE: "+strDATE_ADM[i]+", DIAGNOSIS: "+strPAT_DIAG[i]);
}
}
//-----------------------------------------------
else
if(intREPSELECT == 2) // ALL PATIENTS WHO HAVE A SPECIFIC DOCTOR
{
// SETS A QUERY PROMPT TO SEARCH FOR SPECIFIC RESULTS
strQUERY1 = JOptionPane.showInputDialog(null,"Enter Doctor Name For Search Query",JOptionPane.QUESTION_MESSAGE);
System.out.println("Results For Specific Doctor: "+strQUERY1);
for (i=0; i<intPAT_COUNT; ++i)
{
if (strQUERY1.equals (strPAT_DOC[i]))
{
// LABEL AND PRINT STORED ARRAY VALUES FROM PATIENT DATA FILE
System.out.println(
"NUMBER: "+intPAT_NUM[i]+", NAME: "+strPAT_NAME[i]+", CITY: "+strPAT_CITY[i]+", " +
"DOCTOR: "+strPAT_DOC[i]+", DATE: "+strDATE_ADM[i]+", DIAGNOSIS: "+strPAT_DIAG[i]);
}
}
}
//-----------------------------------------------
else
if(intREPSELECT == 3) // ALL PATIENTS WHO HAVE A SPECIFIC DOCTOR
{
// SETS A QUERY PROMPT TO SEARCH FOR SPECIFIC RESULTS
strQUERY1 = JOptionPane.showInputDialog(null,"Enter Diagnosis Type For Search Query",JOptionPane.QUESTION_MESSAGE);
System.out.println("Patients With Specific Diagnosis "+strQUERY1);
for(i=0; i<=intPAT_COUNT; ++i)
{
if (strQUERY1.equals (strPAT_DIAG[i]))
{
// LABEL AND PRINT STORED ARRAY VALUES FROM PATIENT DATA FILE
System.out.println(
"NUMBER: "+intPAT_NUM[i]+", NAME: "+strPAT_NAME[i]+", CITY: "+strPAT_CITY[i]+", " +
"DOCTOR: "+strPAT_DOC[i]+", DATE: "+strDATE_ADM[i]+", DIAGNOSIS: "+strPAT_DIAG[i]);
}
}
}
//-----------------------------------------------
else
if(intREPSELECT == 4) // ALL PATIENTS ADMITTED BETWEEN SPECIFIC DATES
{
strQUERY1 = JOptionPane.showInputDialog(null,"Enter Admission Date", JOptionPane.QUESTION_MESSAGE);
strQUERY2 = JOptionPane.showInputDialog(null,"Enter Departure Date", JOptionPane.QUESTION_MESSAGE);
System.out.println("Patients Admitted Between "+strQUERY1+" And "+strQUERY2);
// DECLARE VARIABLES FOR ADMISSION DATES
for(Integer i = 0; i <=intPAT_COUNT; i++)
{
// DECLARE VARIABLES FOR ADMISSION DATE AND DEPARTURE DATE
Integer intADM_DATE = strQUERY1.compareTo(strDATE_ADM[i]);
Integer intDEP_DATE = strDATE_ADM[i].compareTo(strQUERY2);
if ((intADM_DATE <= 0)&(intDEP_DATE <= 0))
{
System.out.println(
"NUMBER: "+intPAT_NUM[i]+", NAME: "+strPAT_NAME[i]+", CITY: "+strPAT_CITY[i]+", " +
"DOCTOR: "+strPAT_DOC[i]+", DATE: "+strDATE_ADM[i]+", DIAGNOSIS: "+strPAT_DIAG[i]);
}
}
}
//-----------------------------------------------
else
if(intREPSELECT == 5)
{
}
//-----------------------------------------------
else
if(intREPSELECT == 6)
{
}
//-----------------------------------------------
else
if(intREPSELECT == 7)
{
}
//-----------------------------------------------
else
if(intREPSELECT == 8)
{
}
//-----------------------------------------------
else
if(intREPSELECT == 9)
{
}
//-----------------------------------------------
else
if(intREPSELECT == 10)
{
}
} // END WHILE LOOP
} // END OF REPORT SECTION OPTION 3
//---------------------------------------------------------------------------------------------------------------
// OPTION 4 - MODIFY PATIENT
void voidEXIT_PROG()
{
try
{
// DEFINE A FILE VARIABLE FOR BUFFERED READ
BufferedWriter PAT_FILE = new BufferedWriter (new FileWriter ("patient.dat"));
for (i=0; i<=intPAT_COUNT; ++i)
{
PAT_FILE.write(intPAT_NUM[i] + "#" + strPAT_NAME[i] + "#" + strPAT_CITY[i] + "#"
+ strPAT_DOC[i] + "#" + strDATE_ADM[i] + "#" + strPAT_DIAG[i] + "#");
// WRITE NEW LINE TO ENTRY OF FILE
PAT_FILE.newLine();
} // END LOOP
PAT_FILE.close();
} // END TRY
catch (IOException error)
{
// IF CATCH THEN ERROR MESSAGE OUTPUT
System.out.println("Error On File Read " + error);
} // ERROR ON FILE READ
} // END OF EXIT PROGRAM SECTION OPTION 4
//---------------------------------------------------------------------------------------------------------------
// END OF PATIENT INFORMATION CLASS
} // THE END
hersenen
Profile Joined November 2011
Belize176 Posts
December 13 2011 07:36 GMT
#16
On December 11 2011 22:41 WickedSkies wrote:
Show nested quote +
On December 11 2011 20:46 Random() wrote:
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.


This statement is so pointless :-) Java is one of the most widely used languages and enjoys the best IDE support out there. It is IMO a very good choice of language to learn imperative style programming.

http://langpop.com/
shows an unbiased popularity distribution. In all charts, Java is in the top 3. I wonder why since there is no future in Java...


Just because it's popular doesn't mean it's good or that it has a bright future... I fail to follow your logic. My statement is pointless? I could say every statement in the world is pointless. That's a philosophical question that has no bearings in this conversation.

On December 11 2011 20:03 WickedSkies wrote:
Show nested quote +
On December 11 2011 16:16 hersenen wrote:
I don't see much of a future for Java at the moment. Anything you can do with Java you can kind of do better with other programming languages except it can be used to fill the holes for things PHP can't do in certain web apps which is pretty cool. Good luck with your Java en devours.

Mind I ask what are these other programming languages that can kinda of do better? Keep in mind that the fact you are considering PHP a programming language makes me have a certain opinion about your opinion. Next HTML and bash are programming languages.Good for you, sir, good for you.


PHP is a programming language. There are even compilers for it. And it depends on the project for what languages do it better than Java. I appreciate the condescending tone as you blatantly say wrong things to, it's quite funny.

Java is a corporate owned programming language, and I personally see that as a weakness.
Please log in or register to reply.
Live Events Refresh
WardiTV Korean Royale
12:00
Group Stage 1 - Group B
WardiTV682
TKL 279
Rex110
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 279
RotterdaM 234
Lowko207
SortOf 125
Rex 110
StarCraft: Brood War
Calm 6256
Hyuk 2587
Soma 508
Stork 414
ZerO 343
Pusan 227
Rush 130
Barracks 126
hero 118
Killer 95
[ Show more ]
sSak 84
Sharp 73
Sea.KH 49
ToSsGirL 42
Noble 42
Aegong 40
Backho 39
zelot 37
Free 33
Icarus 26
Movie 21
Shine 18
Sexy 16
Terrorterran 14
sas.Sziky 1
Dota 2
Dendi583
XaKoH 452
XcaliburYe189
BananaSlamJamma2
Counter-Strike
olofmeister1886
byalli545
edward19
Other Games
B2W.Neo1129
crisheroes289
DeMusliM287
Pyrionflax216
Sick211
ZerO(Twitch)4
Organizations
StarCraft: Brood War
lovetv 13
StarCraft 2
IntoTheiNu 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Adnapsc2 5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota241
Upcoming Events
OSC
3h 17m
Replay Cast
10h 17m
Replay Cast
20h 17m
Kung Fu Cup
23h 17m
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
1d 10h
The PondCast
1d 21h
RSL Revival
1d 21h
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
1d 23h
WardiTV Korean Royale
1d 23h
PiGosaur Monday
2 days
[ Show More ]
RSL Revival
2 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
2 days
CranKy Ducklings
3 days
RSL Revival
3 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
3 days
BSL 21
4 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
4 days
RSL Revival
4 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
BSL 21
5 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
5 days
Monday Night Weeklies
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.