Write a java program to find and display the largest and smallest element in an array of members?

4

4 Answers

Jack Buckby Profile
Jack Buckby answered
Someone has written a java program that is being offered for use on a Java forum. The program is found on the following link in a post : forums.techarena.in/software-development/1274649.htm
The software, or the application, has been offered out to everybody as a free application that will be able to arrange numbers in ascending order. If you can't find anything else then the application is at least worth a try - assuming that you know how to code and don't have a problem using code to create an application.

Alternatively, you could try writing your own.

  • One way you could do it, which will be difficult, will include doing the following. You will need to place every one of the values in array, and then using the loop you have, you will have to compare every value with another. This can be incredibly time consuming and really rather boring.
  • Your other option would be to use a simple 'Arrays.sort()' method to sort all of your numbers. Using this method is really easy and can provide a rather simple and easy-to-use Java solution to your problem. Use the code 'eg.int[] array = new int[]{154, 31, 524, 24};
Arrays.sort(array);' for this.

If you cannot make the script work and you can't do it yourself then make sure that you use forums to your advantage. There are so many forums out there that it has become really easy to get help with things like scripting. Simply make your own post on a forum asking people if they have any experience in this and whether they would be able to assist you in getting a java application like this. Most people will be happy to oblige and help you out.
Anonymous Profile
Anonymous answered

Modify the class Time2 given above to include the following methods:
1- A tick method that increments the time stored in a Time2 object by one second:
public void tick()
2- A method that increments the time stored in a Time2 object by one minute:
public void incrementMinute()
3- A method that increments the time stored in a Time2 object by one hour:
public void incrementHour()
4- A method that increments the time stored in a Time2 object by a given number of seconds:
public void incrementSecondsBy(int number)
The Time2 object should always remain in a consistent state. Write a program that tests the tick method,
the incrementMinute method, the incrementHour method to ensure that they work correctly. Be sure to
test the following cases:
a) incrementing into the next minute,
b) incrementing into the next hour and
c) incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM)

Anonymous Profile
Anonymous answered

Modify the class Time2 given above to include the following methods:  1- A tick method that increments the time stored in a Time2 object by one second: Public void tick() 2- A method that increments the time stored in a Time2 object by one minute: Public void incrementMinute() 3- A method that increments the time stored in a Time2 object by one hour: Public void incrementHour() 4-  A method that increments the time stored in a Time2 object by a given number of seconds: Public void incrementSecondsBy(int number) The Time2 object should always remain in a consistent state. Write a program that tests the tick method, the incrementMinute method, the incrementHour method to ensure that they work correctly. Be sure to test the following cases: A) incrementing into the next minute, b) incrementing into the next hour and c) incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM). 

Anonymous Profile
Anonymous answered

Modify the class Time2 given above to include the following methods:
1- A tick method that increments the time stored in a Time2 object by one second:
public void tick()
2- A method that increments the time stored in a Time2 object by one minute:
public void incrementMinute()
3- A method that increments the time stored in a Time2 object by one hour:
public void incrementHour()
4- A method that increments the time stored in a Time2 object by a given number of seconds:
public void incrementSecondsBy(int number) The Time2 object should always remain in a consistent state. Write a program that tests the tick method, the incrementMinute method, the incrementHour method to ensure that they work correctly. Be sure to test the following cases: A) incrementing into the next minute, b) incrementing into the next hour and c) incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).

Answer Question

Anonymous