Write a Java program that takes two kinds of inputs: an array of 10 integers and another
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a Java program that takes two kinds of inputs: an array of 10 integers and another integer. If the array is sorted in ascending order, then the output will be an array of 11 integers where all the integers (10 from the array and another integer) are sorted. If the array is not sorted, then the program will output a message saying “the array is not sorted”
Example 1
>>Enter the array of 10 integers: 3 4 7 12 19 21 22 27 29 42
>>Enter another integer: 18
>> The combined sorted array: 3 4 7 12 18 19 21 22 27 29 42
Example 2
>>Enter the array of 10 integers: 4 8 12 19 17 23 5 42 45 98
>>Enter another integer: 14
>> The inputted array is not sorted.
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date: