1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergeinik [125]
3 years ago
14

Write an algorithm to print the minimum and maximum of an integer array. Your need to pass the array as a parameter. Since we ca

nnot return two values (in this case, minimum and maximum), just print them inside the method. You are allowed to use only one loop. i.e. you are not allowed to traverse the array twice. Note: You can write a Java method instead of pseudo-code but pseudo-code is preferred. Following is a template to start your pseudo code. MinMax(A) min
Computers and Technology
1 answer:
sammy [17]3 years ago
4 0

Answer:

See explaination

Explanation:

MinMax.java

import java.util.*;

public class MinMax

{

static void MinMax(int[] arr)

{

int Min=arr[0]; // initializinf min and max with 1st value of array

int Max=arr[0];

for(int i=0;i<arr.length;i++) // iterating loop only once

{

if(arr[i]>Max) // checking max value

{

Max=arr[i];

}

if(arr[i]<Min) // checking min value

{

Min=arr[i];

}

}

System.out.println("Min Number is "+Min); //printing min value

System.out.println("Max Number is "+Max); //printing max value

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter N value: "); // taking n value

int n=sc.nextInt();

int[] arr=new int[n];

System.out.println("Enter N elements:"); // taking n elements into array

for(int i=0;i<n;i++)

{

arr[i]=sc.nextInt(); // each element into the array

}

MinMax(arr); // calling MinMax() method.

}

}

You might be interested in
3. What is the purpose of the conclusion in an expository essay? (1 point)
Fittoniya [83]
A it makes sense and the conclusion is the wrap up of the essay
7 0
3 years ago
Read 2 more answers
Point out the correct statement.
NeTakaya

Answer:

Option D is correct.

Explanation:

Cassandra labeling information with such a gravestone indicates should restart transmitting an erase request to such a duplicate that had been down earlier of deletion.

Cassandra may not instantly delete information labeled for removal from disc the removal of identified information takes place throughout compaction a deleted section may reappear when a maintenance is never regularly carried out.

4 0
2 years ago
Write a Java test program, named TestGuitar, to create 3different Guitars representing each representing a unique test case and
alina1380 [7]

Answer:

Explanation:

//Guitar.java

import java.awt.Color;

import java.lang.reflect.Field;

import java.util.Random;

public class Guitar

     /**

     * these two fields are used to generate random note and duration

     */

     static char[] validNotes = 'A', 'B', 'C', 'D', 'E', 'F', 'G' ;

     static double[] validDuration = 0.25, 0.5, 1, 2, 4 ;

     /**

     * basic guitar attributes

     */

     private int numStrings;

     private double guitarLength;

     private String guitarManufacturer;

     private Color guitarColor;

     public Guitar()

           /**

           * default constructor

           */

           numStrings = 6;

           guitarLength = 28.2;

           guitarManufacturer = Gibson;

           guitarColor = Color.RED;

     

     public Guitar(int numStrings, double guitarLength,

                 String guitarManufacturer, Color guitarColor)

           /**

           * parameterized constructor

           */

           this.numStrings = numStrings;

           this.guitarLength = guitarLength;

           this.guitarManufacturer = guitarManufacturer;

           this.guitarColor = guitarColor;

     

     /**

     * required getters and setters

     */

     public static char[] getValidNotes()

           return validNotes;

     public static void setValidNotes(char[] validNotes)

           Guitar.validNotes = validNotes;      

     public static double[] getValidDuration()

           return validDuration;

     public

4 0
3 years ago
Janice usually works on a particular workbook that contains all business related data. She decides to keep a backup of all the d
quester [9]

The answer is to use the Ctrl and C keys on the keyboard to copy content from one workbook to another.

The Ctrl and C key is the standard combination keys on the keyboard that is used to copy any selected text or objects while in a user interface environment. Janice is required to press the C key while holding down the Ctrl key to copy all the content to the new workbook.

Another way of doing it is to make sure that both source and target workbooks are open. Navigate the sheets you want to copy or move in the source workbook. Click the Home tab and select then format dropdown in the Cells group. Select move or copy sheet option in the Organize sheet option. Choose the target workbook from the To Book dropdown and click OK.

6 0
3 years ago
Read 2 more answers
To save your new document or presentation, click the Start Button
Vika [28.1K]
No you would click save or save as
3 0
2 years ago
Other questions:
  • When uninstalling software, it is best to delete the folder containing the software?
    11·1 answer
  • How has technology influenced space exploration?
    13·1 answer
  • Schools are businesses that need to install software on a large number of computers can usually obtain a ______
    13·1 answer
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • Could this be restored? And is it worth the money it’d take?
    9·2 answers
  • A technician is configuring a new SOHO multifunction wireless router at a customer’s location to provide network access to sever
    12·1 answer
  • DES: Group of answer choices A) is a commonly used symmetric encryption B) algorithm that was developed in the mid-C) 1970s was
    6·1 answer
  • Which types of files can be used to define Kubernetes manifest files? yaml, json, yaml and text files
    5·1 answer
  • Why bootable installer preparation is important? explain
    9·1 answer
  • The graph shows households in the world with internet access from 2003 to 2019. A graph titled Percentage of Households with Int
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!