ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:
NOTE: SINCE, IT IS A MULTI-PART QUESTION , I WILL DO THE JAVA PROGRAM FOR QUESTION 2 ACCORDING TO HOMEWORKLIB RULES AND GUIDELINES
----------------------------------------------------------------------------------------------------------------
JAVA CODE:
import java.util.*;
public class Main
{
public static void main(String[] args) {
//PART
A-------------------------------------------->
Scanner input = new
Scanner(System.in);
// defining the array for 10
numbers
int arr[]= new int[10];
int count=0;
System.out.println("Enter 10 values
in the array: ");
// getting the 10 integer value
from the user
for(int i=0;i<10;i++)
{
arr[i]=input.nextInt();
}
//PART
B-------------------------------------->
int min=arr[0];
for(int i=1;i<10;i++)
{
if (arr[i]<min)
min=arr[i];
}
//PART
C------------------------------------------------->
// counting how many times the
minimum value occurs in the array
for(int i=0;i<10;i++)
{
if(arr[i]==min)
count++;
}
// printing the minimum value in
the array
System.out.println("Smallest number
in the array is: " + min);
// printing the total occurences of
mimimum value in the array
System.out.println("Smallest number in the array is repeated: " +
count + "times");
}
}
----------------------------------------------------------------------------------------------------------------
SNIPPET:
----------------------------------------------------------------------------------------------------------------
OUTPUT:
----------------------------------------------------------------------------------------------------------------
I hope this would help you out.
If you like my answer , please upvote
If you have any doubt, you can provide comment /feedback below the answer
Thanks
2. Write the statements to do the following tasks. • Create an array of 10 integers...
write a MIPS program that does the following Create an array of 10 INTEGERS. Create procedures to find the largest, and find the smallest. Create another procedure called range, which is the difference between largest and smallest (range should call findLargest and findSmallest) Convert your find largest procedure to be recursive
In Java, Implement a class MyArray as defined below, to store an array of integers (int). Many of its methods will be implemented using the principle of recursion. Users can create an object by default, in which case, the array should contain enough space to store 10 integer values. Obviously, the user can specify the size of the array s/he requires. Users may choose the third way of creating an object of type MyArray by making a copy of another...
Write a MATLAB code to generate an array of 100 random integers between 1 and 10 using the command “randi”. Using “if” statement, impose the condition that if a number in the array is greater than 5, the number is modified as, number = number – 11. Find the sum of the array and store it. Repeat this exercise for 10, 1000 and 100000 trials and plot the following: (a) Sums obtained vs trails number (b) Histogram of the sum...
(C++) Write a function, remove, that takes three parameters: an array of integers, the number of elements in the array, and an integer (say, removeItem). The function should find and delete the first occurrence of removeItem in the array. (Note that after deleting the element, the number of elements in the array is reduced by 1.) Assume that the array is unsorted. Also, write a program to test the function. Your program should prompt the user to enter 10 digits...
Exercise 2: Write array methods that carry out the following tasks for an array of integers by creating and completing the “ArrayMethods” class below. Add documentation comments for each method. Provide a test program called 'Lab5_yourID.java” that test methods of ArrayMethods class. In your test program, use random class to generate array values. public class ArrayMethods { private int[ ] values; //declare instant variables public ArrayMethods (int[] initialValues) {values = initialValues;} //constructor public void shiftRight() { } public Boolean adjacentDuplicate()...
I am told to create a fillArray method that will read integers from the file "data.txt" and store them in the array. I'm told to assume that the file has no more than 100 items in it. This is what I have so far: public void fillArray() { int curVal; Scanner input = null; try { input = new Scanner(new File("data.txt")); // set the current number of items in the array to zero while (input.hasNextInt()) { curVal = input.nextInt();...
PrintArray vi Create a class called PrintArray. This is the class that contains the main method. Your program must print each of the elements of the array of ints called aa on a separate line (see examples). The method getArray (included in the starter code) reads integers from input and returns them in an array of ints. Use the following starter code: //for this program Arrays.toString(array) is forbidden import java.util.Scanner; public class PrintArray { static Scanner in = new Scanner(System.in);...
Write a Java program that allows the following: 1.Create an array list of 20 integers. The 20 integers are generated randomly with possible values from 0 to 10. 2.Print the content of the array list. 3.Find how many of these values are multiple of 3. Show a screenshot of the output with your name and Id in the first line (if there is no screenshot of the output, the student shall get a zero mark for this question). Program typical...
Write a full C++program to do the following processes on a two dimension array of integers. Assume the size is 4x4 . 1- Fill the array with the numbers like this pattern: 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 Note: Do not accept the values as input, or hard code it. Find the math to generate these numbers and fill the array with them. 2- Reset the main diagonal elements...
The purpose of this lab is to manipulate an array of integers. The assignment is to write a program that: 1. Declares an array of integers of some maximum size 20. 2. Implements the following functions: ü A function that prompts the user to initialize the array with up to 20 non-negative whole numbers and mark the end of the input with a negative number. The entire array does not need to be initialized. The user may enter only as...