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
Look at the following description of a problem domain:The bank offers the following types of accounts to its customers: saving a
Alchen [17]

Answer:

The answers are explained below

Explanation:

1) Identify the potential classes in this problem domain be list all the nouns

class Customer

class Acco  unt

2) Refine the list to include only the necessary class names for this problem

the class customer is not necessary to solve the problem itself, therefore the only class could be the account class

3) Identify the responsibilities of the class or classes.

The responsibilities of the class account will be

* determination of the type of account--> Acc  ount . type(char)

*  deposit money into the account --> Acc  ount . de posit(float)

* withdraw money into the account --> Acc  ount . with draw(float)

* show balance of the account --> Acc  ount . bal ance()

* generate interest --> Acc  ount . int erest()

Please join the words together. I used spaces due to regulations

5 0
4 years ago
Website hosting servers have their own unique IP address, what does this address consist of?
Alchen [17]
A. Numbers and letters
4 0
3 years ago
Which memory will be suitable (a) to Run a software (b) to store a software permanently ?
Katena32 [7]

(a) To run a software => RAM

(b) To store a software => ROM

3 0
3 years ago
Help!! me!! plsssssssssssssssssssssssssssssssssss
Maslowich

Answer:

e,f,g, and h

Explanation:

5 0
3 years ago
What are the benefits of BYOD to organisations<br><br><br><br>​
lara [203]

Answer:

Hello, the benefits of BYOD organizations are,

greater flexibility.

increased workforce mobility.

increased efficiency and productivity.

higher employee satisfaction.

allows greater choice in device type.

cuts down hardware spending and software licensing costs.

cuts down on device management for business-owned devices.

Hope this helps :)

5 0
2 years ago
Other questions:
  • What do you call when a hacker users multiple guest computers to crack a password?
    11·1 answer
  • . Why did the designers of the Synchronous Digital Hierarchy choose unusual values for data rates instead of the exact powers of
    11·1 answer
  • Gear systems with __________ can have both drive and driven gears on the same shaft. a. an odd number of gears b. an even number
    6·1 answer
  • If Digital Assistants are free to use why companies do spend millions of dollars to develop and support them?
    8·1 answer
  • What is the useful chart used for comparing values over categories?​
    8·1 answer
  • According to the passage, what are the goals of the<br> program? Check all that apply.
    11·1 answer
  • Write a Python program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Rom
    8·1 answer
  • Define a class named person that contains two instance variables of type string that stores the first name and last name of a pe
    14·1 answer
  • 13. WHICH OF THE FOLLOWING IS INVOLVED IN CREATING A DOCUMENT? *
    7·1 answer
  • Integrated circuits incorporate many transistors and electronic circuits on a single tiny silicon chip, allowing ____ to be even
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!