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
Elenna [48]
2 years ago
9

Create a list with 5 numbers and find the smallest and largest number in the list and also the sum and product of the numbers in

the list, Additionally, find the sum and product of the largest and the smallest number.
Computers and Technology
1 answer:
rusak2 [61]2 years ago
6 0

Answer:

Explanation:

The following code is written in Java. It creates 5 random integers and saves them to a list called myList. Then it loops through that list and checks each one until the largest and smallest values are obtained. Finally, it uses these values to calculate the sums and products as requested. The program has been tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random rand = new Random();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int i = 0; i< 5; i++) {

           int mynum = rand.nextInt(20);

           myList.add(mynum);

       }

       int largest = myList.get(0);

       int smallest = myList.get(0);

       int sum = 0;

       int product = 1;

       int sumLargestandSmallest, productLargestandSmallest;

       for (int x : myList) {

           if (x > largest) {

               largest = x;

           }

           if (x < smallest) {

               smallest = x;

           }

           sum += x;

           product *= x;

       }

       sumLargestandSmallest = largest + smallest;

       productLargestandSmallest = largest * smallest;

       System.out.println("List" + Arrays.toString(myList.toArray()));

       System.out.println("Smallest: " + smallest);

       System.out.println("Largest: " + largest);

       System.out.println("Sum: " + sum);

       System.out.println("Product: " + product);

       System.out.println("Sum of Smallest and Largest: " + sumLargestandSmallest);

       System.out.println("Product of Smallest and Largest: " + productLargestandSmallest);

   }

}

You might be interested in
How do you set up nordvpn with spectrum?
Setler [38]

Answer:

simple

Explanation:

use nordvpn with discount code: Chonchode

7 0
2 years ago
Many PC operating systems provide functionality that enables them to support the simultaneous execution of multiple applications
guapka [62]
The answer is multitasking. This is when the OS always programs to share resources to run at the same time.

If the applications were running on separate CPUs, then it would be multiprocessing.
3 0
2 years ago
If the firewall is configured for credential phishing prevention using the "Domain Credential Filter" method, which login will b
ahrayia [7]

Mapping to the IP address of the logged-in user<u>-will detect  a credential theft</u>

<u></u>

Explanation:

In the "Domain Credential Filter" method the firewall matches the username and the password submitted by the user with the corporate user id and password.

In order to match the credentials submitted by the user the firewalls retrieves data from the bloom filter which is further connected  to windows  User-ID credential service add-on.

The firewall also looks in its Mapping Table for the IP address of the logged-in user

3 0
3 years ago
What is the capital for Russia
s344n2d4d5 [400]

Answer:

Moscow

Explanation:

Moscow is the capital of Russia and was made the capital in 1918.

4 0
3 years ago
Read 2 more answers
The display in D1 should read Colin McCain what text function should be used
Kaylis [27]

Answer:

The answer is "SUBSTITUTE(D1,"c","C",1)"

Explanation:

In the given question, some information is missing, that is an option so, the correct option can be described as follows:  

  • Many of us use the Bulletin feature, which is available in MS-Excel.  In these function the SUBSTITUTE is a method, that is used in Builtin to aim the functions to locate a string or character and to replace with the selected module.  
  • In the case of the end-user, it would like to replace "c" with a capital letter "C." And displays cell shifts in D1. This method uses 4 parameters, in which first describes cell reference, second string to located, third replacing string, and fourth its length.
8 0
2 years ago
Other questions:
  • 3. You are a network administrator responsible for all network platforms and services. The Teta Company currently has only one b
    13·2 answers
  • Name any extension of MS word.
    8·2 answers
  • Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code ha
    14·1 answer
  • Write a JavaScript program to generate the following pattern but the number of rows should be user input.
    8·1 answer
  • Should organizations fear websites where consumers post negative messages about products or services? What actions can companies
    12·1 answer
  • Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
    9·1 answer
  • An operating system that allows a single user to work on two or more programs at the same time is what type of OS?
    14·1 answer
  • Which of the following online creation tools will be used if a person wants to create a video presentation?
    8·1 answer
  • In Python, while loops will repeat during the time the test condition is true.
    7·2 answers
  • If your computer determines the destination address of a network packet is to a remote network.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!