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

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.

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a Java program that takes an array of 10 integers and another integer and then checks whethe... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!