Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Arrays: get the maximum number in each row

 
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone, I want to write a program in Java using Arrays.
Write a program to get the maximum number in each row of a 6*4 matrix and also addition of the maximum numbers.
But we should write it without using any inbuilt methods such as collections or any other methods.
for example ....
{ 22  13  9  15  85  56 }
{ 12  14 66 23  35  74}
{ 36  52 25 19 28  45 }
{ 17  26  6  20 35  78 }
 
Saloon Keeper
Posts: 7324
170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you have so far, and where are you stuck making progress? If you haven't started yet, what ideas have you had?

If you don't know about Java arrays, start reading at https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
 
nicky priya
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done as  .. but i want to give all the arrays at same time without using system.in and addition of all maximum numbers.



 
Marshal
Posts: 75700
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well that seems to work. Now you have got it for one array, work out how you would do it for several arrays. You would obviously do something similar several times.
Please space your code a bit; look at these suggestions. Don't use n in a for loop; use myArray.length.
 
Campbell Ritchie
Marshal
Posts: 75700
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic