Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming Classes start
11-02-2009, 07:30 AM
Post: #11
RE: Programming Classes start
Nice ill be in my chat http://www.freelancecode.net/xchat 8pm centeral
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2009, 07:31 AM
Post: #12
RE: Programming Classes start
(11-02-2009 07:30 AM)codecaine Wrote:  Nice ill be in my chat http://www.freelancecode.net/xchat 8pm centeral

I have a pretty good chance of being there Tongue

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2009, 08:56 AM (This post was last modified: 11-02-2009 08:57 AM by codecaine.)
Post: #13
RE: Programming Classes start
Here is the exercise completed by me
Code:
//This program was coded by Jerome Scott II aka codecaine

public class Exercise2 {

    public static void main(String[] args) {
        //initialize a character to A
        char myChar = 'A';
        //print if the character is a digit or digit
        System.out.println("Is letter: " + Character.isLetter(myChar));
        System.out.println("Is Digit: " + Character.isDigit(myChar));
        //initialize a string to hello world
        String helloStr = "hello world";
        //print the length of the string
        System.out.println("helloStr length: " + helloStr.length());
        //initialize the a StringBuff to helloStr varible value
        StringBuffer strBuf = new StringBuffer(helloStr);
        //loop through the length of the StringBuffer
        for(int x = 0; x < strBuf.length(); x++){
            //if the number is even check if its lowercase if so convert it to a uppercase character
            if( (x % 2) == 0){
                if(Character.isLowerCase(strBuf.charAt(x)))
                    strBuf.setCharAt(x, Character.toUpperCase(strBuf.charAt(x)));
            }
            //if the character is uppercase covert it to lowercase
            else{
                if(Character.isUpperCase(strBuf.charAt(x)))
                    strBuf.setCharAt(x, Character.toLowerCase(strBuf.charAt(x)));
            }
        }
        //print the StringBuffer showing alternated upper and lower cases
        System.out.println(strBuf);
        //reverse the StringBuffer
        strBuf.reverse();
        //print the StringBuffer showing the reverse order
        System.out.println(strBuf);
    }

}

If you copy my code save it as Exercise2.java and then you compile it with javac Exercise2.java
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2009, 11:33 AM (This post was last modified: 11-02-2009 11:34 AM by Back_track.)
Post: #14
RE: Programming Classes start
i'm in 8:32 EST Tongue
sorry if too late

Erg i need to get a voice D:

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2009, 07:29 AM
Post: #15
RE: Programming Classes start
This is a good idea
Find all posts by this user
Quote this message in a reply
02-06-2010, 04:46 PM
Post: #16
RE: Programming Classes start
Anybody using Netbeans 6.8? I try to run that code, and no output is shown. Maybe it's default it to only show GUI apps.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: