Get in touch with us
Send us an e-mail
Question
Write a program to assign the integer values 1 through 25 to a 25-element integer array. Then, print the array as five separate lines, each containing five elements separated by commas. The last element on each line should be followed by a newline instead of a comma. The output of your program should appear exactly as follows:
1,2,3,4,5
6,7,8,9,10
11,12,13,14,15
16,17,18,19,20
21,22,23,24,25
Hints:
One way to determine every 5th element is to use the modules operator (%). If you divide the subscript by 5 and the remainder is 0, it is the 5th number.
You can use System.out.print() to print a value without a newline following it. This allows you to print multiple things on the same line.
You may use the Windows Command Prompt command line interface or any Java IDE you choose to compile and execute your program. You are to submit the following deliverables to the Assignment Dropbox in a single Microsoft Word file:
a. A screen snapshot of your Java source code (just the beginning is OK) as it appears in your IDE (e.g., jGRASP, Net Beans, Eclipse, etc.) or editor (e.g., a Windows Command line more of the .java file's first screen).
b. A listing of your entire Java source code in the same Microsoft Word file as item a), and following item a). You can simply copy and paste the text from your IDE into Microsoft Word. Be sure to maintain proper code alignment by using Courier font for this item.
c. A screen snapshot of your program’s output in the same Microsoft Word file, and following item b).
Summary
The question belongs to Computer Science and it discusses about writing a program in Java about assigning integer values 1 through 25 to a 25 element integer array. The source code for the program has been given in the solution.
Total Word Count 135
Being a computer science engineer is my dream and it wouldn’t have possible for me to understand the basics of C++ programming without the help of TheReliableTutor and the engineering assignment tutors. I grasped C programming on my own, but for C++ and Java, I am definitely grateful to TheReliableTutor.
You guys never fail to surprise me. Thanks for helping me with my finance assignment.
I found it very difficult in keeping up with the assignments with the rest of the class and also had problems with the topics like probability, displaying data etc. Then I found TheReliableTutor.com and all my misery has come to an end. The stats experts here helped me out with all my assignments and since then I have been getting better grades. Thanks a lot….
I had no clue about how to write a qualitative research paper on Faulkner and so I approached TheReliableTutor.com. I was also not sure whether they could help me or not but to my surprise they started asking the right kind of questions to me. When I clarified them with my professor, she was impressed and told me that I understood the concept of a research paper. The rest of it was a walk in the park. With my professor’s inputs they provided an excellent research paper and help me get an A
I was on the verge of failing my course when i found these guys. The tutors are excellent. They helped me improve my grade and pass the course with flying colors.
Comments
this is a very good website
I have 50 questions for the same test your page is showing only 28
hi can you please help or guide me to answer my assignments. thanks
hi can anyone help or guide me to my assignments. thanks
This solution is perfect ...thanks
Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes
Perfect bank of solution.
great !
thanks for the quick response. the solution looks good. :)
thnx for the answer. it was perfect. just the way i wanted it.
works fine.