Results 1 to 14 of 14
Like Tree2Likes
  • 2 Post By Tolls

Thread: i beg you help me please with these two array problem using JCreator

  1. #1
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default i beg you help me please with these two array problem using JCreator

    class Exercise2
    {
    public static void main ( String[] args )
    {
    int[] val = {13, -4, 82, 17};
    int[] twice;

    // create a loop that can output the double value from the original array

    // Construct an array object for twice.


    // Put values in twice that are twice the
    // corresponding values in val.

    // create a loop that can output the double value from the original array

    }
    }
    Complete the program so that a new array twice is constructed. Now copy values from val to twice, but make the values in twice double what they are in val.

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

    Default Re: i beg you help me please with these two array problem using JCreator

    Do you have any specific questions or problems?
    If so please ask them.

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

    Default Re: i beg you help me please with these two array problem using JCreator

    This is your second thread begging someone to do your work. Please let's knock this off.

  4. #4
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    yes sir the question is in the above.

    i need to create a loop that can output the double value from the original array (int[] val = {13, -4, 82, 17};)
    , Construct an array object for twice and Put values in twice that are twice the corresponding values in val.

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

    Default Re: i beg you help me please with these two array problem using JCreator

    Do it one step at a time.
    a loop that can output the double value
    Please explain how to get a double value from an int array.

  6. #6
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    i have this code but it is not working!
    Java Code:
    import java.io.* ;
    class array 
    { 
        public static void main ( String[] args ) throws IOException 
        { 
            
            int[] val = {13, -4, 82, 17}; 
            int[] twice;
            int multiply;
            
            
            
        BufferedReader inData=new BufferedReader(new InputStreamReader(System.in)); 
    
        // create a loop that can output the double value from the original array  
            
        
        
        for (int i=0; i < val.length; i++) 
            {     
        
            System.out.print(val[i] + " \n");
        
        
        multiply = val[i] * 2;
        twice = new int [multiply];
        System.out.print(twice + " \n");
        
    
        
        }
    Last edited by Norm; 01-10-2012 at 03:13 PM. Reason: added code tags

  7. #7
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    the output should be
    val = 13, -4, 82, 17
    twice = 26, -8 , 164, 34

    because the instruction said i need to give value of the "twice" comes from the x2 of the val = 13, -4, 82, 17

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

    Default Re: i beg you help me please with these two array problem using JCreator

    You forgot to post what the current program prints out when it executes.

    If you have errors, please copy and paste them here.

  9. #9
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    ohhh! i dont have JCreator here in my desktop!
    can you help me solve this problem sir? please?

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

    Default Re: i beg you help me please with these two array problem using JCreator

    Please post the full text of the error messages you are getting.

  11. #11
    janroz is offline Member
    Join Date
    Jan 2012
    Posts
    16
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    ok got it! the eror said "twice = new int [multiply];" Twice initialize

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

    Default Re: i beg you help me please with these two array problem using JCreator

    That is NOT the full text of an error message.
    It doesn't say what the error is.

    Please copy full text of error message and paste it here. Here is a sample:
    Java Code:
    TestSorts.java:138: cannot find symbol
    symbol  : variable var
    location: class TestSorts
             var = 2;
             ^
    Last edited by Norm; 01-10-2012 at 05:43 PM.

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: i beg you help me please with these two array problem using JCreator

    Why on earth have you got a BufferedReader in there?

    Honestly, don't copy code if you have no idea what it is you're looking at.
    Fubarable and quad64bit like this.

  14. #14
    stchman's Avatar
    stchman is offline Member
    Join Date
    Apr 2011
    Location
    Saint Louis, Missouri
    Posts
    97
    Rep Power
    0

    Default Re: i beg you help me please with these two array problem using JCreator

    Hint:

    You already have the val array created, would it not be a valid assumption that the twice array would contain the same number of elements? All you would then do it to just loop through the val array, multiply by 2 and then put those values into the twice array.

    You don't need BufferedReader for this since you have declared and initialized the val array.

    FYI, you don't need JCreator do write Java programs. If you are using Windows, use Notepad++ as IDEs usually confuse absolute beginners.
    If you aren't programming in Java, well that's just too bad.
    I'd rather be using Ubuntu.

Similar Threads

  1. Replies: 0
    Last Post: 05-12-2011, 07:04 PM
  2. Replies: 1
    Last Post: 10-08-2010, 02:19 AM
  3. Ide(Jcreator) and jdk
    By dangr in forum New To Java
    Replies: 0
    Last Post: 01-12-2010, 08:02 AM
  4. About using jcreator
    By yuchuang in forum JCreator
    Replies: 4
    Last Post: 11-29-2008, 08:29 PM
  5. jcreator
    By nikhil_solanki015 in forum JCreator
    Replies: 2
    Last Post: 10-28-2008, 07:04 PM

Tags for this Thread

Posting Permissions

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