6:10
6:57 - 47 = 6:10
Hope this h
Answer:
The following are the program in the Java Programming Language.
//import the following class
import java.util.Scanner;
//define class
public class TimeConversion
{
//define main function
public static void main(String[] args)
{
//create the object of the scanner class
Scanner s = new Scanner(System.in);
//print message
System.out.println("Enter the minutes: ");
//get input in the variable
int t=s.nextInt();
//initialize in the variable
int hr=t/60;
//initialize in the variable
int min=t%60;
//declare the string type variable
String result;
//initialize in the variable
result=""+hr;
//check that the variable is less than 10
if(min<10)
//then, initialize this
result=result +":0"+min;
//otherwise
else
//initialize this
result=result +":"+min;
//print the result
System.out.println(result);
}
}
<u>Output</u>:
Enter the minutes:
184
3:04
Explanation:
<u>The following are the description in the program</u>.
- Firstly, import the scanner class and define the class 'TimeConversion', inside the class, we define the main method and inside the main method.
- Create the object of the scanner class 'c' and then get input from the user in the variable 't' through the scanner class object.
- Then, declare the variable 'hr' and initialize the value input divided by 60. Declare the variable 'min' and initialize the value input mod by 60.
- Declare the string data type variable 'result' then, check that the variable 'min' is less than 10 then, initialize the following format in the variable 'result' and otherwise the initialize the other formate in the variable 'result'.
- Finally, we print the variable 'result'.
Answer:
The correct answer is A, spreadsheets. Spreadsheet programs are similar to and include Excel, with grids of cells for organizing numerical data
Answer: Option (c) is correct
Explanation:
PDF is portable document format that come in form of file format .It is used for sharing and transmitting between computing and operating systems for viewing and printing in actual page layout. They can be used fro eBooks ,scanned document and text etc.
- Other options are incorrect because not all business organization use PDF, PDF has the capability of being edited and it stands for "portable document format".
- Thus, the correct option is option(c)
Since both arrays are already sorted, that means that the first int of one of the arrays will be smaller than all the ints that come after it in the same array. We also know that if the first int of arr1 is smaller than the first int of arr2, then by the same logic, the first int of arr1 is smaller than all the ints in arr2 since arr2 is also sorted.
public static int[] merge(int[] arr1, int[] arr2) {
int i = 0; //current index of arr1
int j = 0; //current index of arr2
int[] result = new int[arr1.length+arr2.length]
while(i < arr1.length && j < arr2.length) {
result[i+j] = Math.min(arr1[i], arr2[j]);
if(arr1[i] < arr2[j]) {
i++;
} else {
j++;
}
}
boolean isArr1 = i+1 < arr1.length;
for(int index = isArr1 ? i : j; index < isArr1 ? arr1.length : arr2.length; index++) {
result[i+j+index] = isArr1 ? arr1[index] : arr2[index]
}
return result;
}
So this implementation is kind of confusing, but it's the first way I thought to do it so I ran with it. There is probably an easier way, but that's the beauty of programming.
A quick explanation:
We first loop through the arrays comparing the first elements of each array, adding whichever is the smallest to the result array. Each time we do so, we increment the index value (i or j) for the array that had the smaller number. Now the next time we are comparing the NEXT element in that array to the PREVIOUS element of the other array. We do this until we reach the end of either arr1 or arr2 so that we don't get an out of bounds exception.
The second step in our method is to tack on the remaining integers to the resulting array. We need to do this because when we reach the end of one array, there will still be at least one more integer in the other array. The boolean isArr1 is telling us whether arr1 is the array with leftovers. If so, we loop through the remaining indices of arr1 and add them to the result. Otherwise, we do the same for arr2. All of this is done using ternary operations to determine which array to use, but if we wanted to we could split the code into two for loops using an if statement.