Share
Explore BrainMass

Java Application DblArray.java

Write a Java application that can hold five doubles in an array, and display the doubles from first to last, and then display the doubles from last to first. Use the following logic for BubbleSort to sort and display the array in sequence.

Int comparisonToMake = someNums.length - 1;
for (a = 0; a < someNums.length - 1; ++a)
(
for(b = 0; < comparisonToMake; ++b)
(
if(someNums[b] > sp,eMi,s[b + 1])
(
temp = someNums [b];
someNums[b] > = someNums[b + 1]';
someNums[b + 1] = temp;
)
)
--comparisonToMake;
)

Solution Preview

Please rename attached 441198-DblArray.java as DblArray.java before compiling and running the program. It takes 5 double values as input from user and then displays them first to last and then last to ...

Solution Summary

Attached Java program takes 5 double values as input from user and then displays the content of doubles array as asked. Solution also provides the output of a sample session for easier verification.

$2.19