![]() |
| ||
| arrays in java!!! hi all! i'm having difficulties with arrays in java. i've got a few questions that i'm kind of stuck on and their really bugging me! i'm new to java so if anyone can help with the following questions, i'd REALY appreciate it!!!! 1) Write a loop that creates an integer array p with the values as shown: 3 6 9 12 15 18 21 24 27 2) Use another loop which makes adjustments to the values of the array p in a) as shown: 3 6 10 14 18 22 26 29 32 3) Declare a two dimensional array with 10 rows and 10 columns initialise: a) All the elements in the 6th row to -1 b) All the elements of the 7th column to 4 4) 1 2 3 4 5 3 -22 6 8 -3 14 9 31 -1 0 52 1 13 71 29 65 15 22 33 53 Write the loops needed to print the diagonal elements of the above two dimensional array. Te elements of each diagonal are a) 1 –22 31 71 53 b) 5 8 31 1 65 PLEASE PLEASE PLEASE can sumone help me answer these questions!! THANKS!!!!!!!!!!!!!! |
| ||
| Re: arrays in java!!! PLEASE HELP!!!!!!!!!!! If you're learning Java without a reference, get a reference. If you have a reference, READ IT! I mean, come on, how trivial does this have to be before you can figure it out on your own? Any book on Java will cover every single one of those questions. Not only that, they'll all tell you where to find the information from both the table of contents AND the index! Hell, with a beginner's book you could probably flip to somewhere in the middle and hit on at least one of the answers. >PLEASE PLEASE PLEASE can sumone help me answer these questions!! No. If you can't do this on your own then you're beyond any help. I swear... |
| ||
| Re: arrays in java!!! PLEASE HELP!!!!!!!!!!! Now, now Narue. Let's be nice to our new members :) Hey there militant. We actually have a rule around these parts that we won't help with your homework unless you show us some effort that you've tried to do it yourself already. Then we'll give you a hand by pointing you in the right direction. |
| ||
| Re: arrays in java!!! PLEASE HELP!!!!!!!!!!! oh soz about that. didnt mean to offend anyone. i will take your advice. cheers for the reply anyway! :cheesy: |
| ||
| Re: arrays in java!!! PLEASE HELP!!!!!!!!!!! hi! thanks for your reply. ok wel basically, i have tried to do these questions but am getting nowhere coz i don't realy understand the java programming language too well at the moment. heres what i have attempted. ------------------------------------------------------------------------ 1) Write a loop that creates an integer array p with the values as shown: 3 6 9 12 15 18 21 24 27 p = new int [8]; // initialise array for (int i=0; i <=8; i++) // for loop { i = i + 3; system.out.println(p[i]); } ------------------------------------------------------------------------ 2) Use another loop which makes adjustments to the values of the array p in a) as shown: 3 6 10 14 18 22 26 29 32 not sure about this one! ----------------------------------------------------------------------- 3) Declare a two dimensional array with 10 rows and 10 columns initialise: a) All the elements in the 6th row to -1 b) All the elements of the 7th column to 4 p = new int [10] [10]; // intialise two dimensional array not sure about the rest! ----------------------------------------------------------------------- 4) 1 2 3 4 5 3 -22 6 8 -3 14 9 31 -1 0 52 1 13 71 29 65 15 22 33 53 Write the loops needed to print the diagonal elements of the above two dimensional array. Te elements of each diagonal are a) 1 –22 31 71 53 b) 5 8 31 1 65 p = new int [5] [5] // intialise two dimensional array this is all i know! c, im stuk!! :o -------------------------------------------------------------------- PLEASE PLEASE PLEASE can sumone help me answer these questions!! THANKS!!!!!!!!!!!!!! |
| ||
| Re: arrays in java!!! Honestly, I'm getting more and more disappointed every time I see someone say, "I'm not doing your homework for you." and I'll tell you why... I've been a programmer for many years now. I've seen many horrible text books, on top of equally horrible professors there are out there - and I've even experienced many myself. Yes, there are going to be those students that really don't want to try, and will go to any length to cheat in order to get by. Guess what? Not surprising that they're going to fail, and there's nothing that can be done about that. They will go elsewhere to get what they're seeking. However, there are those who are honestly stuck - even if it's right out of the gate, and they don't know how to start - their books and professors aren't helping, so they turn to the Internet for guidance. This is what help forums are all about: Help. Many people need examples in order to understand how things work - or at least the pseudo code to help them through the process. Being a very visual learner myself, learning by example is extremely helpful in turning on the ol' lightbulb - especially when most textbooks out there are so confusing for beginners. So when people ask for help with something - homework or not - and they're told "Not doing your homework!" That's not helping anyone. Don't think about those who are out there to slack off - there will always be those out there. What you need to do is help those who need to learn by example. Providing code snippets, or even the pseudo code will make a huge difference to those dedicated to learn, but shutting people down entirely is highly discouraging. |
| ||||
| Re: arrays in java!!! Quote:
Quote:
Quote:
Quote:
Edit: P.S. you did realise this thread is nearly three years old, right? If not, you should maybe touch up on your "attention to detail" discipline. It could only help. |
| ||
| Re: arrays in java!!! Quote:
Wow, you know... I didn't know "pro bloggers" were the only ones allowed on this forum to have any sort of opinion on a topic. The rude thing works for you, because you surely put me in my place. |
| ||
| Re: arrays in java!!! What rude thing? And because someone responded to your post your offended? What of the above points were incorrect? What of the above points do you have a response to? Oh, you were simply offended that not everyone agreed with your rant? |
| ||
| Re: arrays in java!!! tech74, if you wished to leave a feedback about the way some responses are handled here you would better do it in Coffe House ==> DaniWeb Community Feedback. There is realy no point open an old post and arguing about it. So please, if you have anything to say regarding this forum do so in section of this forum designed for this purpose |
| All times are GMT -4. The time now is 11:20 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC