What's up, guys? Today we're back to the card game! We can probably finish it up today, but be aware that the actual act method is long, although it is just a switch statement, so not necessarily complex. I'll leave it to last so we can get the easy stuff out of the way, first.
Showing posts with label learn java free. Show all posts
Showing posts with label learn java free. Show all posts
Monday, 19 December 2011
Sunday, 18 December 2011
Java: String Formatting (Pictures!) and the Switch Statement
Okay so, apparently no pictures is a huge no-no, so I'll briefly show you how string formatting works with the power of screenshots! And yeah, looking back on yesterday's post, I agree, it was kinda shitty, so, sorry about that :P
So, string formatting! First, we need to formulate a template string in which data will be entered later!
So, string formatting! First, we need to formulate a template string in which data will be entered later!
Saturday, 17 December 2011
Java: String Formatting
First off: To Damian in the comments: The game could kick the player when its discovered they're broke, but that's not up to the player class! It's up to either the Table or the ConsoleClient!
Okay! Short post today, just covering string formatting. We saw in some code there was a string returned that looked roughly like:
"This is the message, %s, %f"
...within a method that took 2 more parameters. When printed out this way, the first parameter, the string, is the format of the message to be printed out. A percentage sign followed by a letter denotes where you'll want to put data in afterwards.
Okay! Short post today, just covering string formatting. We saw in some code there was a string returned that looked roughly like:
"This is the message, %s, %f"
...within a method that took 2 more parameters. When printed out this way, the first parameter, the string, is the format of the message to be printed out. A percentage sign followed by a letter denotes where you'll want to put data in afterwards.
Friday, 16 December 2011
Java: Texas Hold Em (23)
Hey hey, time for another post. Last time we left off at getCash for the Player class, after a number of get methods and some other crap. Luckily, there's a buttload more of get methods to go through, so we still have some easy stuff around. Just a heads up though, on Monday we'll go through a larger method that uses the switch-statement.
This week is my final make-up week where I make weekend posts, so tomorrow, as promised, I'll cover string formatting in more detail, and on Sunday I'll actually refresh us all on the switch statement, just in case you need it!
This week is my final make-up week where I make weekend posts, so tomorrow, as promised, I'll cover string formatting in more detail, and on Sunday I'll actually refresh us all on the switch statement, just in case you need it!
Subscribe to:
Posts (Atom)