Results 1 to 4 of 4
  1. #1
    Chicken's Avatar WHY DAVE

    Join Date
    Jul 2012
    Country
    Posts
    174
    Thanked
    36
    Thanks
    45
    Hello, can someone please tell me how this code should be?
    It has to be coded in java

    1. Ask the user to input a number of type double which you will find the square root of the number.

    2. Create a method called rootPositive which will either print the square root of the number passed to it or if the number is less than zero, it will print out the statement "Number must not be negative.".

    3. Call your rootPositive method and pass to it the number the user enetered.

    thank you

  2. #2
    Banned

    Join Date
    Aug 2012
    Country
    Posts
    679
    Thanked
    394
    Thanks
    615
    I would but I don't want to do your homework.

    Stupid br.

  3. The following 2 users say thank you to Paul for this useful post:

    Historia (08-17-2017), Pigglet (08-16-2017)

  4. #3
    GeorgeGFX's Avatar secret.club

    Join Date
    Nov 2010
    Country
    Posts
    15,459
    Thanked
    2,331
    Thanks
    5,080
    If you want to get into the field of coding, it's a bad thing (and a bad habit also) asking people to literally write the code for you.
    I could do it and so could other people but it would be pointless if you're not even trying to write the code yourself, not doing that would get you to nowhere..
    A few hints;
    Create a variable > parse it to double/decimal and read it from the console (say it's nameOfVariable).
    Create a method called rootIsPositive(double <nameOfVariable>)
    Make a boolean inside the method and set it to true
    Make if-checks or use create a whole case (an if would be better) > write your algorithm > done.

    >>> Credits to Sikk408 @ DevaintArt <<<

  5. The following user said thank you to GeorgeGFX for this useful post:

    Charm Hye (08-17-2017)

  6. #4
    Chicken's Avatar WHY DAVE

    Join Date
    Jul 2012
    Country
    Posts
    174
    Thanked
    36
    Thanks
    45
    Originally Posted by GeorgeGFX View Post
    If you want to get into the field of coding, it's a bad thing (and a bad habit also) asking people to literally write the code for you.
    I could do it and so could other people but it would be pointless if you're not even trying to write the code yourself, not doing that would get you to nowhere..
    A few hints;
    Create a variable > parse it to double/decimal and read it from the console (say it's nameOfVariable).
    Create a method called rootIsPositive(double <nameOfVariable>)
    Make a boolean inside the method and set it to true
    Make if-checks or use create a whole case (an if would be better) > write your algorithm > done.
    Meh I really dont want to get into coding, Its in my school subject and i cant change it bc im late asf, anyway thanks for the help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)