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
FinnZ [79.3K]
2 years ago
14

Create a program that allows the user to pick and enter a low and a high number. Your program should generate 10 random numbers

between the low and high numbers picked by the user. Store these 10 random numbers in a 10 element array and output to the screen.
In java code please.
Computers and Technology
1 answer:
Natalka [10]2 years ago
4 0

Answer:

import java.util.Scanner;

import java.util.Arrays;

import java.util.Random;

public class Main {

 public static void main(String[] args) {

   Scanner scan = new Scanner(System.in);

   System.out.print("Enter low: ");

   int low = scan.nextInt();

   System.out.print("Enter high: ");

   int high  = scan.nextInt();

   scan.close();

   int rndnumbers[] = new int[10];

   Random r = new Random();

   for(int i=0; i<rndnumbers.length; i++) {

     rndnumbers[i] = r.nextInt(high-low+1) + low;

   }

   for(int i=0; i<rndnumbers.length; i++) {

     System.out.printf("%d: %d\n", i, rndnumbers[i]);

   }

 }

}

You might be interested in
Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes
Elan Coil [88]

Answer:

See Explaination

Explanation:

package testscores;

import java.util.ArrayList;

import java.util.List;

public class TestScores {

public List<Integer> scorearray=new ArrayList<>();

public TestScores(List<Integer> scores) throws InvalidTestScore{

this.scorearray=scores;

for(int i=0;i<scorearray.size();i++){

if(scorearray.get(i)>100 || scorearray.get(i)<0){

throw new InvalidTestScore(this.scorearray.get(i));

}

}

}

public double average(){

int tot=0;

for(int i=0;i<this.scorearray.size();i++){

tot=tot+this.scorearray.get(i);

}

return tot*(1.0)/(this.scorearray.size());

}

class InvalidTestScore extends Exception

{

private double amount;

public InvalidTestScore(int Score)

{

System.out.println("Invalid Score "+Score);

}

}

}

8 0
3 years ago
Draw truth table for the following logic circuit:<br><br> (Please I really need help with this)
DENIUS [597]

Keep Scrolling! :D

\rule{999pt}{66646pt}

4 0
2 years ago
Final one bit l y links are a virus that will corrupt your files do not go on it
diamong [38]

Answer:

ok mk

Explanation:

3 0
2 years ago
Read 2 more answers
What is faster C++ or go lang
alukav5142 [94]

Answer:

C++

Explanation:

3 0
2 years ago
Which type of app is the best choice when it is critical to be able to use the device's features but performance is not critical
lisov135 [29]

Answer:

Hybrid.

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are seven (7) main stages in the creation of a software and these are; planning, analysis, design, development (coding), testing, implementation and execution, and maintenance.

Some of the models used in the software development life cycle (SDLC) are;

I. A waterfall model: it can be defined as a process which involves sequentially breaking the software development into linear phases. Thus, the development phase takes a downward flow like a waterfall and as such each phase must be completed before starting another without any overlap in the process.

II. An incremental model: it refers to the process in which the requirements or criteria of the software development is divided into many standalone modules until the program is completed.

III. A spiral model: it can be defined as an evolutionary SDLC that is risk-driven in nature and typically comprises of both an iterative and a waterfall model. Spiral model of SDLC consist of these phases; planning, risk analysis, engineering and evaluation.

Basically, softwares are categorized into three (3) main categories based on the development platform and these are;

a. Web application.

b. Native application.

c. Hybrid application.

A hybrid application is a type of software application that is designed based on the combination of the elements of both web applications and native applications.

Typically, a hybrid application is a web application that is developed in a native application shell, using a standardized web programming language such as CSS, JavaScript, and HTML.

Generally, a hybrid application avails a programmer the opportunity to write a code for a mobile application once while accommodating or being compatible with multiple app platforms such as Android, Windows, iOS, etc.

Hence, a hybrid application is the best choice of an application when it's critical for the end users to be able to use the features associated with a device such as a mobile phone but performance isn't critical.

4 0
3 years ago
Other questions:
  • A plan that outlines the steps and timeline for reaching a certain goal is called a(n):
    13·1 answer
  • A commonly used font style is _____. superscript periwinkle times new roman point
    7·1 answer
  • Gabriel needs to create a formula that does not change when it is copied to cell b2. which formula should he create?
    14·1 answer
  • What is the definition of D1-D4?
    14·1 answer
  • Brainliest to whoever answers this first, i need help explaining.
    8·1 answer
  • The 7-bit ASCII code for the character ‘&amp;’ is: 0100110 An odd parity check bit is now added to this code so 8 bits are trans
    12·1 answer
  • Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bu
    13·1 answer
  • Match the IP Protections Patent, Copyright and Trademark into the following cases:
    12·1 answer
  • Help please i will give Brainliest
    7·1 answer
  • Is TCP really more secure than other L4 protocols by default?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!