Its to delete the files from the computer that you no longer want. Once its put in the recycling bin it stays there, then when you empty it, its off your computer and there is no way you can get those files back. This can also free-up some space from your computer since mega and giga bites are being removed from your computer.
Answer:
struct PatientData{
int heightInches, weightPounds;
};
Explanation:
In order to declare the required struct in the question, you need to type the keyword <em>struct</em>, then the name of the struct - <em>PatientData</em>, <em>opening curly brace</em>, data members - <em>int heightInches, weightPounds;</em>, <em>closing curly brace</em> and <em>a semicolon</em> at the end.
Note that since the object - lunaLovegood, is declared in the main function, we do not need to declare it in the struct. However, if it was not declared in the main, then we would need to write <em>lunaLovegood</em> between the closing curly brace and the semicolon.
Answer:
- public class FindDuplicate{
-
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
-
- int n = 5;
- int arr[] = new int[n];
-
- for(int i=0; i < arr.length; i++){
- int inputNum = input.nextInt();
- if(inputNum >=1 && inputNum <=n) {
- arr[i] = inputNum;
- }
- }
-
- for(int j =0; j < arr.length; j++){
- for(int k = 0; k < arr.length; k++){
- if(j == k){
- continue;
- }else{
- if(arr[j] == arr[k]){
- System.out.println("True");
- return;
- }
- }
- }
- }
- System.out.println("False");
- }
- }
Explanation:
Firstly, create a Scanner object to get user input (Line 4).
Next, create an array with n-size (Line 7) and then create a for-loop to get user repeatedly enter an integer and assign the input value to the array (Line 9 - 14).
Next, create a double layer for-loop to check the each element in the array against the other elements to see if there is any duplication detected and display "True" (Line 21 - 22). If duplication is found the program will display True and terminate the whole program using return (Line 23). The condition set in Line 18 is to ensure the comparison is not between the same element.
If all the elements in the array are unique the if block (Line 21 - 23) won't run and it will proceed to Line 28 to display message "False".