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

1. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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. ## Re: i beg you help me please with these two array problem using JCreator

Do you have any specific questions or problems?

3. ## 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. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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. ## 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. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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;

// 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. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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. ## 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. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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. ## 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. Member
Join Date
Jan 2012
Posts
16
Rep Power
0

## 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. ## 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. Moderator
Join Date
Apr 2009
Posts
13,541
Rep Power
27

## 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.

14. ## 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.

#### Posting Permissions

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