Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0

    Default Please please need help with refactoring>>> urgent>>>

    public class ExcessControll
    {
    public static void main(String args[])
    {
    double x,y,z
    x=60
    y=5

    z=x*y;

    System.out.println("test ="+z);
    if(z<100){
    System.out.println("bad");
    }
    else if(z<200){
    System.out.println("good");
    }else{
    System.out.println("great");
    }
    }



    THIS IS JUST AN EXAMPLE FOR REFACTORING>> WHAT I AM NOT UNDERSTANDING IS THIS>>> CAN WE REFACTOR THIS CODE>> PLEASE HELP ME WITH THIS...

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,563
    Blog Entries
    7
    Rep Power
    21

    Default Re: Please please need help with refactoring>>> urgent>>>

    A few remarks:

    1) use [code] ... [/code] tags to make your code readable for your audience;
    2) don't shout, there's no reason for it;
    3) it isn't urgent to us; there's no need to try to hurry us;
    4) 'if it ain't broken, don't fix it', so why refactor a tiny snippet of code?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0

    Default Re: Please please need help with refactoring>>> urgent>>>

    But I was given to refactor this... I dont how to though... So the anwser to this question, is it to just leave it as it is.? Im not sure how what to do?

  4. #4
    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0

    Default Re: Please please need help with refactoring>>> urgent>>>

    I didnt mean to rush you guys..

  5. #5
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: Please please need help with refactoring>>> urgent>>>

    If this is about learning how to refactor the code then you can just try to refactor it. The code might be to simple to refactor but you can refactor it for example by extracting the lines in the main method to create another method. For example you can create a method that can return the string "bad", "good" or "great" based on the arguments passed to this method.

Similar Threads

  1. Need help urgent!
    By sea2011 in forum Advanced Java
    Replies: 1
    Last Post: 07-15-2012, 07:39 PM
  2. Replies: 0
    Last Post: 03-28-2012, 12:53 PM
  3. [URGENT]SHA Encryption System...need urgent helps
    By java_idiot in forum New To Java
    Replies: 6
    Last Post: 05-02-2010, 10:04 AM
  4. Refactoring
    By Nirmala102 in forum New To Java
    Replies: 3
    Last Post: 11-06-2009, 11:18 AM
  5. need urgent help!!
    By ras_pari in forum New To Java
    Replies: 3
    Last Post: 10-30-2009, 07:06 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
  •