Page 2 of 2 FirstFirst 12
Results 21 to 33 of 33
Like Tree1Likes

Thread: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

  1. #21
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by Tolls View Post
    Pretty much.
    (Note you could put it on a new line).

    Apologies for the use of slang.
    The first sentence is less slangy.
    Hehe yes indeed. My technical language, or jargon if you may, isn't strong with me, since I started this part of my education last Friday :)

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Can you post the code from lines 1 to line 18?

  3. #23
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by Norm View Post
    Can you post the code from lines 1 to line 18?
    Here we go.

    Java Code:
    public class opg1_promille {
    
    	public static void main(String[] args) {
    		
    		java.util.Scanner tastatur = new java.util.Scanner(System.in); // Tastatur: "keyboard" in Danish
    		System.out.println("Hvor mange gange er du blevet stoppet?");  //How many times have you been stopped for DUI?
    		
    		int stoppet; 
    		stoppet = tastatur.nextInt(); tastatur.nextLine();
    
    		
    		
    		System.out.println("Hvad er din promille?"); //what is your alcohol level?
    		
    		double promille;
    		promille = tastatur.nextDouble(); tastatur.nextLine();
    My quest to learn Java started Friday the 24th of February, 2012. LEARN ALL THE JAVA.

  4. #24
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    That code works for me.
    How do you write decimal numbers on your computer?
    Do you use a comma or a period for fractional numbers?
    1.23
    1,23

  5. #25
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by Norm View Post
    That code works for me.
    How do you write decimal numbers on your computer?
    Do you use a comma or a period for fractional numbers?
    1.23
    1,23
    I used a period "1.23" Since I was told that's how double works. - And GOD DAMN, I'M STUPID for not trying to use a comma!
    It's working as I want now! phew..

    I wish I could +rep you, but since I'm brand-new on this forum...
    My quest to learn Java started Friday the 24th of February, 2012. LEARN ALL THE JAVA.

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

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by spande View Post
    I used a period "1.23" Since I was told that's how double works. - And GOD DAMN, I'M STUPID for not trying to use a comma!
    It's working as I want now! phew..

    I wish I could +rep you, but since I'm brand-new on this forum...
    It's all in the API documentation; Scanners read Locale specific formats; learn to read the API documentation; oh, and b.t.w. don't curse.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #27
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by JosAH View Post
    It's all in the API documentation; Scanners read Locale specific formats; learn to read the API documentation; oh, and b.t.w. don't curse.

    kind regards,

    Jos
    Guy, REALLY new at this. I mean, I don't even know what API documentation is. (guess that's my problem though*smiles*) Oh, and b.t.w. I'm not cursing at anyone, besides myself. Not offending anyone, am I?

    Best attitudes,

    Alex :*
    My quest to learn Java started Friday the 24th of February, 2012. LEARN ALL THE JAVA.

  8. #28
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    If you'd read post #10 you would see a link to the Java API doc.
    Java Platform SE 6

  9. #29
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by spande View Post
    Oh, and b.t.w. I'm not cursing at anyone, besides myself. Not offending anyone, am I?
    Yes, you are.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  10. #30
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by DarrylBurke View Post
    Yes, you are.

    db
    That was not in my intentions to offend anyone. Sorry if anyone felt offended.

    I got my questions anwsered - thanks to everybody who've helped out the new guy :)

    Alex
    My quest to learn Java started Friday the 24th of February, 2012. LEARN ALL THE JAVA.

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

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by spande View Post
    That was not in my intentions to offend anyone. Sorry if anyone felt offended.

    I got my questions anwsered - thanks to everybody who've helped out the new guy :)

    Alex
    Forget about it; you'll know for later; also, bookmark that link because you'll need it on a daily basis and it answers a lot of questions (see reply #10 again). There's also a Java version 7 API but I'm sure Google knows about it if you need it.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  12. #32
    spande is offline Member
    Join Date
    Feb 2012
    Location
    Vordingborg, Denmark
    Posts
    14
    Rep Power
    0

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by JosAH View Post
    Forget about it; you'll know for later;
    I'm sorry, know about what? :)
    My quest to learn Java started Friday the 24th of February, 2012. LEARN ALL THE JAVA.

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

    Default Re: What's wrong with my code? (Danish java-programmer would be greatly appriciated!)

    Quote Originally Posted by spande View Post
    I'm sorry, know about what? :)
    Not to curse, it is not appreciated.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Page 2 of 2 FirstFirst 12

Similar Threads

  1. What is wrong in this code of java
    By kank635 in forum New To Java
    Replies: 1
    Last Post: 01-16-2012, 09:41 PM
  2. Replies: 5
    Last Post: 12-08-2011, 07:54 PM
  3. Java Calculator Help Would Be Greatly Appreciated
    By TommyR in forum New To Java
    Replies: 1
    Last Post: 03-14-2011, 09:30 PM
  4. Please look at my java code and tell me what's wrong
    By xcointoss in forum Advanced Java
    Replies: 3
    Last Post: 10-22-2010, 04:15 AM
  5. what wrong with my java code
    By MAXZZXAM in forum New To Java
    Replies: 3
    Last Post: 11-19-2009, 09:38 AM

Posting Permissions

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