Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes. If we're not in the trash yet, then the experiment still has worth. If we are, as you put it, an 'unchecked mold', then we'll need to worry about when the Lysol and fungicides get broken out.

The Lysol may already be out and we just don't recognize it yet :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Will that be the day HE considers the experiment failed and throws all of mankind into the trash?

Perhaps we are already in the trash. Perhaps we started out in the trash to begin with and grew and developed in the manner of unchecked mold. Does it really make any difference at this point?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>these programming languages would be like everyday english
I don't see why this would be some great advantage to make programming more accessible. Most people can't use "everyday English" properly either.

Salem commented: Got that right! +13
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Does it say so in the Bible? If so, I missed it, sorry!

Well, even if it did, it would be irrelevant - so you needn't be sorry.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

A char literal needs to be in single quotes

char a = 'a';
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... and also that

char a = a;

won't compile...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I am new to java and having issues...

I am using this code as an example but when I try to view it all I get is a blank screen. Can someone tell me what to write in my notepad to view the applet. I have this now

<html>
<head>
<title>Dice Game Canvas</title>
</head>
<body>
<h1 align=center>Contact Application</h1>
<center>
<applet name="ContactApp"
code="ContactApp.class"
width=400
height=150>
</applet>
</center>
</body>
</html>

I don't know if this is correct if any one can help. Thank you.

Your code is not an applet - it is a standalone frame demo class. You need to code it as an applet if you wish to use it as one:
http://java.sun.com/docs/books/tutorial/deployment/applet/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

How about because of the probable consequences if you have chosen incorrectly in this issue?

No different than the consequences if you have chosen incorrectly. I've made my peace with that.

Should you regret the lack? Probably not; if you're wrong, you'll be regretting them enough in the end.

If I get caught in a rain storm without an umbrella I will get wet and regret not having brought one. Should I never leave my house without an umbrella?
If I were to be struck by lightning in such a storm, certainly I would regret leaving my house to go out. Should I never leave my house for fear of a storm?
Of course not. We all make decisions weighing the risks as they are known to us. Given that I believe the risks you suggest are unfounded speculation, I can't see as how dwelling upon them is worth the time.

Are you sure that's fear? I'd call it simply expectation, possibly eager expectation.

Scru specifically said "Because then after that my existence would just cease. Do you know how dizzy the thought of that makes me?". To me, that sounds an awful lot like fear and it was his statement that I was addressing. It was not an empirical statement per se.

And how do you determine what is right in the first place? Pretty much every version of right/wrong I've seen stems from religious beliefs.

I do not believe that absence of religion …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So is the world ending then or what? ;)

Yes.
We just have to argue out the timetable. This might take awhile.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If I were an athiest I think I would be afraid. Because then after that my existence would just cease. Do you know how dizzy the thought of that makes me?

As an atheist, why should I fear the end of existence more than any other? Because I have no delusions of "something better" to look forward to after death? Should I regret the lack of what I feel are false hopes and mollifications? It can't be changed - being human is 100% fatal. You are going to die. Get used to it. If anything, you are obviously much more afraid than the atheist, as you cannot even think about facing the end of existence without a promise that something better awaits beyond it.

Live your life now as best you may. Do what is right for the sake of it being right, not just for marks on some after-death scorecard towards imagined rewards. If you look at the time you have on earth as all that you're going to get, you might just be more inclined to value it more and do something worthwhile with it. On the other hand, if you think of it as a waiting and evaluation period that you must endure to reach that "something better", you might just find yourself sorely disappointed if you are wrong.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
class ModuleDriver
{
  public static void main(String args[])
  {
     Module m1 = new Module();
      m1.moduleId =  "Module Id: CG0048\n";
      m1.moduleName =" Module name: Programming 2\n";
      m1.setRoom("Lecture Room: pandon S1\n");
      m1.setModuleTutor("Module Tutor: Alan Maughuan");
     System.out.println( m1.toString());
     
  }// end of main()
}

I think it meets the marking criteria.
do you think that meets the marking criteria?
the marking criteria:-

No, far from it. You have only used one constructor. You need to show usage of all of the other constructors as well. Also, you are setting the public properties directly. Those need to be made private and you should set them with the accessor methods.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I wouldnt be excercising all the methods if I define it in the driver and thats the problem I have. The driver has to use all the methods. If I create the strings in the driver class then it does execute the methods. I really am confused about how I do this now.

What? Define it in the driver? You aren't "defining" anything in the driver - you are using the class you have built. Currently, you only use one of the constructors. You need to use the others as well. Depending on which constructor you use, the amount of additional information you need to set on the object will change.

Your class variables should not be public and you should initialize them to appropriate default values - not specific strings that you happen to want to print. If you want those variables to hold those values, you should set them via the accessors or the constructors. The class itself should be generic and have no information relating to any one particular module.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just like any other constant: Year.FIRST, Year.SECOND, etc.

http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

just cant seem to get moduleId and module name to print out in my driver file. this is the driver file

Because, as Masijade already told you above, you have set all your variables to empty strings in that constructor and you haven't set values for them in your "driver".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I need to do this:
<snip>

Please do not hijack other people's threads for unrelated questions. Post this as a new thread of its own.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, that is one piece. You have to actually use that variable though

public class Student extends Person
{
  Year studentYear;

	public Student( String name, String address, String phone,
		String email, Year grade )
	{
		super( name, address, phone, email);
                this.studentYear = grade;
	}
	
	public enum Year
        {
	Year FIRST = new Year( "Freshmen"),
	Year SECOND = new Year("Sophmore"),
	Year THIRD = new Year("Junior"),
	Year FOURTH = new Year("Senior");

	public final String gradeLevel;
	
	Year( String grade )
	{
		gradeLevel = grade;
	}
	
	public String getGradeLevel()
	{
		return gradeLevel;
	}
	
    }
	
	public String toString()
	{
		return String.format( "%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n\n" ,
			"Student Object",
			"Name", getFullName(),
			"Address" , getHomeAddress(),
			"Phone #" , getPhoneNumber(),
			"E-mail Address" , getEmailAddress(),
			"Grade Level", studentYear.getGradeLevel() );
	}
}
DeadJustice commented: thanks +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So bascially I change String grade to Year grade? I don't understand what you mean in the first sentence.

Yes, and that needs to be stored in a variable of the enum type Year in your class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need a variable of type Year to hold that value in the Student class. Your constructor would also pass a Year value instead of a String. toString() can access the getGradeLevel() method of the enum value to display the string representation you have given those constants.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Put this in your local paper, and see what happens...
"Wanted - psychic. You know who to call".

Heh, would really freak you out if someone called though :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I actually did use Quote tags back to that post but for some reason it did not post with them properly.

Well appoligies from those of us who are not perfect like josh and have enough time to post in realtime like him.

Last time i checked a Forum was not an IM system and hence does get a little bit scew wiff like that. But hey if josh thinks otherwise then i guess i was wrong. If i had of known that it was to confusing for you josh i would never have posted it.

Shame on you for running afoul of Josh's infallible judgement of relevance and acceptable posting practices. Did you not take account of his High Inquisitor Of Relevance And Forum Mores badge? Dare you question the Order and sow chaos in the Pattern of asynchronous communication?! Instigator!

joshSCH commented: haha.. FU -2
lasher511 commented: Even Josh's negative rep out for you. +3
Rashakil Fol commented: Rep doesn't matter in the Geek's Lounge. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Okay, this is what we have so far for the reasons the world, as we know it, will end:
Meteor
Black Hole
Gamma Rays
Nuclear War
Regular War
Religious War
Superbug
TV
Antichrist
Catastrophic release of Carbondioxide
Massive Vulcano Eruption
Massive Earthquake
Abortion
Gay Rights
High Taxes
The Poor Get Poorer
Excess Liberals
Hillary Healthcare
Social Conservatives
Fascism
Demagoguery
Surveillance Society
"Nation Building"
Chemical Contamination of Food and Toys
Overpopulation
...
and all of the above at once!

Might have missed a few major ones.

Actually, as you read this, the world as you know it just ended.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, it kind of replaces all of these methods

readNumberOfTeams();
readNumberOfGames();
getTheGameScores();

to generate the data for team scores for each game. Your averages method(s) needs to loop through this info to make its calculations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That looks really cool (totally new concept)lol
I will definately try that tonight. Thanks If you don't mind tomorrow I will tell you if it worked.

You might want to check out this book sometime: Head First Java

From what I have heard, it covers a lot of these object-oriented design topics very well. It was listed in a semi-recent "Top Java Books" posting over in JavaLobby and seems to be well-regarded. I've not read that one myself, but I was very impressed with the "Head First Design Patterns" book, which shares a couple of authors and the same presentation style.

ceyesuma commented: outStanding! +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"pc" is a ProcessCard object. newAccount() is just changing the account number - it is not creating a new object. To do that you need to set pc = new DebitCard(); That will create a DebitCard object, which inherits from the ProcessCard. Unless you need to call a method that is specific to the DebitCard class, you can still use the debit card object by it's ProcessCard base class interface.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

got it. thanks :)

In GridBagLayout.. i have the code:

c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.[B]EAST[/B];
    gridbag.setConstraints( rice, c );
    add( rice ); //the Label
    c.gridx = 1;
    c.anchor = GridBagConstraints.[B]WEST[/B];
    gridbag.setConstraints( rice1, c );
    add( rice1 ); //the TextField

screenshot
im just wondering why the Rice(Label) is on the west side and Rice(TextField) on the east side?

The anchor property describes where the control is anchored within the cell. The gridx and gridy control the cell position. So in the above, you have the label in position x=0 and anchored to the east edge of that cell. The text field is in position x=1 (which is to the right of x=0), and anchored to the west edge. Is that what you wondered about?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I will go thru and add comments I guess. If you were to run the program.creditcard processes work and debit card uses creditcard"

public DebitCard{
super();
}

but when I try the same process using DebitCard all the variables remain set for creditcard.
well thanks any way. I'll work on it some more.

Do you actually create a DebitCard object to perform the operations on? It sounds like you are still calling methods against a CreditCard object.

You should consider trying to use full, descriptive names for your variables and methods, rather than cryptic abbreviations. I thought this was touched on in the coding conventions, but looking back I don't see it and must be thinking of a different document. Clear names that spell out the intent of a variable or method will help not only other readers of your code, but you as well. It's much easier to organize your thoughts when the intent of the code is clearly spelled out by variables and methods.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Honestly, this is almost impossible to read and follow. Reading and following this may help a bit: Code Conventions for the Java(TM) Programming Language: Contents

The functioning of the methods and their names are just too non-intuitive to wade through. If you can post the relevant lines where you are having difficulty, perhaps someone can help.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, you missed a couple:
Social Conservatives
Fascism
Demagoguery
Surveillance Society
"Nation Building"

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to read and think about these errors a bit. Is there a version of the write() method that takes a component? Nope, all of them take char or String data. A TextArea is not the same.

Take the time to examine the API documents of the classes you are using. Those explicitly lay out how you may interact with all of the JDK classes that you use. Make sure you have those bookmarked.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

A vector is nothing more than an indexed collection of objects. A vector is also an object, which can therefore reside in a vector - a collection of collections. It's the same as a two dimensional array.

Vector teams = new Vector(numberOfTeams);
for (int i=0; i<numberOfTeams; i++){
  Vector team = new Vector(numberOfGames);
  for (int j=0; j<numberOfGames; j++){
    int gameScore = generateScore(); // some method to generate a random score
    team.add( gameScore );
  }
  teams.add( team );
}

Doing the math on these is now just a matter of writing the loops over the teams and their scores.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's writing whatever "output" is to a buffered file output stream. If you just copied that in from somewhere, and you don't have a variable "output", then it certainly won't work.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Of course a superbug like MRSA might beat them all to it!

... or SARS... or H5N1 bird flu... or Ebola...
Always something isn't there? Chicken Little will always have something in the wings to crow over.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you are just learning, why are you concerned with the need for the .NET environment? Learn to program before worrying about distribution issues. C++ is not dying out. There is still a lot of work available. Again, not an issue to be concerned with when you are just starting out. If you learn one of them and need to use the other, you can cross that bridge when you come to it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to keep a vector of vectors for this. The main vector to hold a vector for each team. The team vector would hold the score of each game the team has played. Averaging these by game and team is then just a matter of nesting the inner and outer loops in the correct order.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

array[16][1][3] is of no practical use. Why nest the third level under a second level that only contains a single item? You are just making more work for yourself and creating potential problems by doing that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You people are getting confused between newline and carriage returns. A carriage return is just a carriage return and is always '\r'.

It's the 'newline' character which is different on different systems. (\r, \n, \r\n)

Yes, agreed. I just figured he was asking in a more general sense about line breaking characters.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, System.getProperty("line.separator") can be used for the system you are running on, but if you are reading files from external sources the linefeeds may differ from your own.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just like you would identify any other character in a string: look for "\r\n" or "\n" (system dependent).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try some of the things mentioned in this thread from JCreator forums:
http://www.jcreator.com/forums/lofiversion/index.php/t525.html

I think you just need to update the project properties.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just compile and run it from the command line.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I've not used JECreator, but did you perhaps set a main class for your project somewhere? A properties window or some such? It sounds as if it still thinks that is your main class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Read the error in its entirety, especially the name of the class it reports and the line number. Try to figure out why the compiler cannot see that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

cannot find symbol when i included the xxxx.replaceSelection("replacement text");....??

Then "xxxx" is probably not a text component.

how can i save a file using a save button? heheh

I'm sure the site that I linked above has examples of using a BufferedWriter to write a text file as well. Writing to a file should have been covered in your class if you are expected to do that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Can you elaborate a little more on the question? All object creation is done through constructors. If no constructor is specified, the compiler will supply a default empty constructor that basically does nothing. If you wish to provide info that initializes some values in the object when it's created, you provide a constructor for those parameters and initialize those values in that constructor.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, it's not correct. You need to re-examine the basics of class structure. You don't even have the class, constructor, and main method defined correctly.

This is just cobbled together pieces of UI creation code with no methods to actually do any computations. Even if it did compile it wouldn't do anything.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The compiler gives you more information than just "errors".

Post the errors and what you think might be the reason for them. You need to learn how to interpret those messages and deal with the cause. Throwing up your hands and saying "I have errors!" won't get you too far.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Typically you would select the 0 when the user clicks in the field rather than erasing it. That way they can replace it by merely typing a value,but if they leave the field you don't have to reset it. You can find some examples of working with text selection here: http://www.exampledepot.com/egs/javax.swing.text/Selection.html

That site is very useful for finding short code examples for many things and is worth keeping bookmarked :)