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
Ugo [173]
3 years ago
5

Define global variables called highestNum, userInput and sumOfNums and initialize them. In Main call 2 methods: 1) UserData() 2)

DisplayResults()
Task #1:In the UserData() method ask the user to give you a number between 9 and 20, exclusive. Validate this input Then, create a loop that will loop THAT amount of times. Inside that loop generate a random number between 1-100. In that loop check each generated number in order to find the highest number generated. Accumulate all numbers to sumOfNums
Task #2: In the displayResults() method print the following: "There were x numbers generated" "the highest number generated is x" "The sum of the numbers is x" "The average of these numbers is x"
Computers and Technology
1 answer:
Montano1993 [528]3 years ago
5 0

Answer:

Explanation:

The following code is written in Java. It creates the two methods as requested using the Scanner and Random built-in classes in Java. Once the loop is completed and the highestNum is calculated, then the displayResults method is called to print out all the information in the correct format. The output of the program can be seen in the attached image below.

import java.util.Random;

import java.util.Scanner;

class Brainly {

   static int highestNum = 0;

   static int userInput;

   static int sumOfNums = 0;

   public static void main(String[] args) {

       userData();

       displayResults();

   }

   private static void userData() {

       Scanner in = new Scanner(System.in);

       Random rand = new Random();

       System.out.println("Enter a number between 9 and 20: ");

       userInput = in.nextInt();

       if ((userInput >= 9) && (userInput <= 20)) {

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

               int num = rand.nextInt(100);

               if (num > highestNum) {

                   highestNum = num;

               }

               sumOfNums += num;

           }

       }

   }

   public static void displayResults() {

       System.out.println("There were " + userInput + " numbers generated");

       System.out.println("The highest number generated is " + highestNum);

       System.out.println("The sum of the numbers is " + sumOfNums);

       int average = sumOfNums / userInput;

       System.out.println("The average of the numbers is " + average);

   }

}

You might be interested in
Your client noticed that his ad was disapproved for editorial reasons. Why is it important for him to understand and abide by Go
astra-53 [7]

Answer: Ad Words policies can help ensure ads are useful, varied, relevant, and safe for web users

Explanation: Google Ads do have a policy for the ad display which requires that the ads should be secured, relevant and safe for the users on the web. Google Ads positively review every Ads that is created or has been changed in some terms as their policy. It maintains the standard and relevancy on the web and no objectionable content gets posted .

This might be the reason that the client's ads are disapproved because he/she is not aware of the Google's ads policies.

3 0
3 years ago
What is the purpose of the ISOWEEKNUM function?
Zarrin [17]
Answer is D
Stay safe !
3 0
3 years ago
Read 2 more answers
A company wants to use online methods to target more customers. It decides to conduct a market research by collecting the data o
Ronch [10]

Answer:

They could use a CRM

A CRM tool lets you store customer and prospect contact information, identify sales opportunities, record service issues, and manage marketing campaigns, all in one central location — and make information about every customer interaction available to anyone at your company who might need it.

They Could Use PDC

The term “primary data” refers to data you collect yourself, rather than data you gather after another party initially recorded it. Primary data is information obtained directly from the source. You will be the first party to use this exact set of data.

They Could Use Quantitative vs. Qualitative Data

Quantitative data comes in the form of numbers, quantities and values. It describes things in concrete and easily measurable terms. Examples include the number of customers who bought a given product, the rating a customer gave a product out of five stars and the amount of time a visitor spent on your website.

Why Should I Track Users Data:

To ensure it's going smoothly, it's important to keep track of data that directly correlates to the potential success of your business. Key performance and financial metrics can help you address any problems with your business before they occur

8 0
3 years ago
Ted wants to go out to a neighborhood park and shoot pictures of dew drops on grass. He wants to get a low-level angle of the de
daser333 [38]

i believe that the answer to this question is c


8 0
3 years ago
Read 2 more answers
To move or copy a range of cells, select the correct order:
Karo-lina-s [1.5K]

Answer:

Correct Order

2. Select the cell or range you want to move or copy.

1. Move the pointer over the border of the selection until the pointer changes shape.

3. To move the range, click the border and drag the selection to a new location, or to copy the range, hold down the Ctrl key and drag the selection to a new location.

Explanation:

To move or copy range of cells in MS Excel, You first select the cell/range you want to move or copy, hover the mouse pointer and take note when it changes shape, then finally click the border (when you noticed the change of shape of the pointer) and hold down the ctrl key and drag it to the destination location.

6 0
3 years ago
Other questions:
  • Write multiple if statements. if caryear is 1969 or earlier, print "probably has few safety features." if 1970 or higher, print
    6·1 answer
  • What date does GTA 6 come out<br> A. 2020<br> B. 2019<br> C. 2021<br> D. 2022
    10·2 answers
  • What is the purpose of application software policies?
    12·1 answer
  • The algorithm and flowchart
    9·1 answer
  • It’s Saturday and you’re looking forward to hanging out with friends and having some fun. However, you get two phone calls early
    10·1 answer
  • I need to change the subject before they get onto me. I am only revealing info today if you are a friend.
    5·1 answer
  • PLEASE HURRY!!!!<br> Look at the image below
    8·1 answer
  • Please solve the ones you can. Solving Both will be appreciated. thank you
    13·1 answer
  • Susan is a network monitoring technician working on a firewall for her company’s network. In the process to determine an open po
    8·1 answer
  • Which Windows registry hive stores information about object linking and embedding (OLE) registrations
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!