Page 3 of 5 FirstFirst 12345 LastLast
Results 41 to 60 of 89
Like Tree6Likes

Thread: Java

  1. #41
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    there are no errors and if eclipse is an IDE than ya im using one

  2. #42
    EscSequenceAlpha is offline Senior Member
    Join Date
    Apr 2012
    Posts
    115
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    there are no errors and if eclipse is an IDE than ya im using one
    sorry I was in a rush with that last message I hope it made sense.

    when you get an error during execution that stops the program its called an unresolved runtime error (when you cant run the program its a compilation error). Eclipse should give you some red writing indicating what went wrong. this is actually the stack trace. if you get errors in the future and want someone to help you figure it out please post the output and stack trace for us.

    I have an assignment for you if you're interested involving the switch statement and for loops.

  3. #43
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by EscSequenceAlpha View Post
    sorry I was in a rush with that last message I hope it made sense.

    when you get an error during execution that stops the program its called an unresolved runtime error (when you cant run the program its a compilation error). Eclipse should give you some red writing indicating what went wrong. this is actually the stack trace. if you get errors in the future and want someone to help you figure it out please post the output and stack trace for us.

    I have an assignment for you if you're interested involving the switch statement and for loops.
    for loops? i haven't learned those yet, but tell me what you want me to do and ill do it when i know how

  4. #44
    EscSequenceAlpha is offline Senior Member
    Join Date
    Apr 2012
    Posts
    115
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    for loops? i haven't learned those yet, but tell me what you want me to do and ill do it when i know how
    Its not advanced but you do need to understand loops and the switch statement, its a rewarding early program to do.

    It's called the 12 days of christmasu. basically you want to print out all the verses (you can look them up on google) of the song.

    you store each line of text in a string, the loop will print each verse and the switch statement will print all the lines for that verse.
    Legend has it the moderators and senior members of java-forums.org were able to code skyrim using only 701 lines of java... or so the legend goes.

  5. #45
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    for loops? i haven't learned those yet, but tell me what you want me to do and ill do it when i know how
    What have you done in those two or three years? Didn't you misspell "weeks"?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #46
    EscSequenceAlpha is offline Senior Member
    Join Date
    Apr 2012
    Posts
    115
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by JosAH View Post
    What have you done in those two or three years? Didn't you misspell "weeks"?

    kind regards,

    Jos
    He probably started and gave up x years ago...

    Among the ranks of java-forums.org there was moderator who faced chuck norris in a dual on a dusty plain in some far away land. Before chuck could land his round house kick the moderator coded him out of existence
    Legend has it the moderators and senior members of java-forums.org were able to code skyrim using only 701 lines of java... or so the legend goes.

  7. #47
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by EscSequenceAlpha View Post
    Its not advanced but you do need to understand loops and the switch statement, its a rewarding early program to do.

    It's called the 12 days of christmasu. basically you want to print out all the verses (you can look them up on google) of the song.

    you store each line of text in a string, the loop will print each verse and the switch statement will print all the lines for that verse.
    Im sorry but i really cant figure out how to do this ><

  8. #48
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    Im sorry but i really cant figure out how to do this ><
    Programming is beyond you; forget about it and find something else.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #49
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by JosAH View Post
    Programming is beyond you; forget about it and find something else.

    kind regards,

    Jos
    im not giving up, i just learn slow. I'll get it eventually.

  10. #50
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    im not giving up, i just learn slow. I'll get it eventually.
    Good; that's the spirit; start working on the problem from reply #44.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #51
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    can i have, like a hint on how to do this? 'cause im racking my brain trying to do this but one i start trying i draw a blank, i feel like i should know this but i guess i don't.

    also let me see if i got this right:

    a for loop would be like this-
    Java Code:
    for(int i = 1; i<11;i++){System.out.println("Count is" + i);}
    and a switch statement is like -
    Java Code:
     int age = 3; switch (age){ case 1: System.out.println("You can crawl"); break; case 2: System.out.println("you can talk"); break; case 3: System.out.println("you can use the toilet"); break; default: System.out.println("Yoou too old."); break;

  12. #52
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java

    Suppose you have twelve cards, all with text on them: "a partridge in a pear tree", "two turtle doves", "three french hens" etc. also you have a choir in front of you that doesn't know the text of the song. Write down the number of the cards (1 ... 12) in the correct order you have to show to make the choir sing the song.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  13. #53
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    i think this project is to difficult for me :/ could i get something easier? maybe something that will get me used to using for loops and switch statements? but doesnt require a bunch of lines of code (bunch >=20)

  14. #54
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    i think this project is to difficult for me :/ could i get something easier? maybe something that will get me used to using for loops and switch statements? but doesnt require a bunch of lines of code (bunch >=20)
    Perhaps it would be better if you just bought a book on Java, like the Head First Java, and then move through the book one page and chapter at a time, not skipping a page until you've completed the whole thing. This way you will progress by baby steps with each subsequent step building on your knowledge gained from the previous steps.

  15. #55
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by Fubarable View Post
    Perhaps it would be better if you just bought a book on Java, like the Head First Java, and then move through the book one page and chapter at a time, not skipping a page until you've completed the whole thing. This way you will progress by baby steps with each subsequent step building on your knowledge gained from the previous steps.
    i dont have $44.00 to spend on a book :/ thats why ive been relying on the internet to teach me

  16. #56
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: Java

    Quote Originally Posted by JoshieWashiePoo View Post
    i dont have $44.00 to spend on a book :/ thats why ive been relying on the internet to teach me
    If you really want to learn, it's a worthwhile investment that can rid you of much frustration. Up to you. Or better -- buy it used. Amazon is selling used versions for $17.
    Last edited by Fubarable; 05-19-2012 at 10:06 PM.

  17. #57
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by Fubarable View Post
    If you really want to learn, it's a worthwhile investment that can rid you of much frustration. Up to you. Or better -- buy it used. Amazon is selling used versions for $17.
    where do you see it for $17? i can only find 20-25+

  18. #58
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    this is all i could get

    Java Code:
    class Christmas {
    	public static void main(String[] args){
    		
    		for(int verse = 1; verse<13;verse++){
    			System.out.println("On the first day of chirstmas my true love gave to me");
    		
    		switch(verse){
    		case 1:
    			System.out.println("A partridge in a pear tree");
    			break;
    		case 3:
    			System.out.println("Two turtle doves");
    			break;
    		case 4:
    			System.out.println("Three French hen");
    			break;
    		case 5:
    			System.out.println("Five golden rings");
    			break;
    		case 6:
    			System.out.println("Six geese a-laying");
    			break;
    		case 7:
    			System.out.println("Seven swans a-swimming");
    			break;
    		case 8:
    			System.out.println("Eight maids a-milking");
    			break;
    		case 9:
    			System.out.println("Nine ladies dancing");
    			break;
    		case 10:
    			System.out.println("Ten lords a-leaping");
    			break;
    		case 11:
    			System.out.println("Eleven pipers piping");
    			break;
    		case 12:
    			System.out.println("Twelve drummers drumming");
    			break;
    		
    		
    			}
    		
    		}
    	}
    }
    i cant figure out how to mkae it say second and then third ect.. in place of the first day of christmas, also cant figure out how to mkae it repeat the last verse after the new one (example - first verse A partridge in a pear tree - second verse Two turtle doves --repeat-- A partridge in a pear tree)

  19. #59
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    199
    Rep Power
    0

    Default Re: Java

    Well, you would have to replace the string in quotes with several strings that are concatenated together:

    "On the" + day[verse]+ "of chirstmas my true love gave to me"

    and then declare day as:

    Java Code:
       private static String[] day =  {"first","second","third","forth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth","thirteenth"};

  20. #60
    Join Date
    May 2012
    Posts
    28
    Rep Power
    0

    Default Re: Java

    Quote Originally Posted by Fubarable View Post
    Perhaps it would be better if you just bought a book on Java, like the Head First Java, and then move through the book one page and chapter at a time, not skipping a page until you've completed the whole thing. This way you will progress by baby steps with each subsequent step building on your knowledge gained from the previous steps.
    I found a PDF for volume two of that book, that fine?

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •