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
Digiron [165]
3 years ago
11

How to set the maximum to 10? Java

Computers and Technology
1 answer:
hichkok12 [17]3 years ago
6 0
Public int setLimit(parameter) {
if (parameter > 10) {
return 10;
} else {
return parameter;
}
}
You might be interested in
A database stores a large amount data in vertical ___
myrzilka [38]

Records for the first one and table for the second one

4 0
3 years ago
Why do computers need system software?
Marina86 [1]
<span>Computers don't need system software. System software is used to automate many tasks so the user can achieve more. Actually, one of the ideas of computer programming is to avoid needless repetition. The system software will prepare the computer for the user.</span>
5 0
3 years ago
Question 7 of 25
Vika [28.1K]

Explanation:

the right answer may be A.

5 0
2 years ago
Write a test client for Randomthat checks that two methods, namely, nextGaussian()and nextLong()in the library operate as expect
xenn [34]

Answer:

/ TestRandom.java

import java.util.Random;

public class TestRandom {

   // method to find the mean value of set of numbers

   // using Number as data type, so that it can represent both Double and Long

   // types needed for this program

   static double calculateMean(Number array[]) {

        double sum = 0;

        // summing values

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

            sum += array[i].doubleValue();

        }

        // finding average and returning it

        double avg = (double) sum / array.length;

        return avg;

   }

   // method to find the standard deviation value of set of numbers

   // using Number as data type, so that it can represent both Double and Long

   // types needed for this program

   static double calculateSD(Number array[], double mean) {

        // initializing sum of squared difference between each number and mean

        // to 0

        double sumSquaredDiff = 0;

        // looping

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

            // finding difference between current number and mean, squaring the

            // result, adding to sumSquaredDiff

            sumSquaredDiff += Math.pow(array[i].doubleValue() - mean, 2);

        }

        // finding variance

        double variance = (double) sumSquaredDiff / array.length;

        // finding square root of variance as standard deviation

        double sd = Math.sqrt(variance);

        return sd;

   }

   public static void main(String[] args) {

        // if no command line arguments given, displaying usage and quit

        if (args.length == 0) {

            System.out.println("Usage: java TestRandom <n>");

            System.exit(0);

        }

        // parsing first argument as integer N

        int N = Integer.parseInt(args[0]);

        // declaring a Double array and a Long array of size N

        Double gaussian[] = new Double[N];

        Long lng[] = new Long[N];

        // Random number generator

        Random random = new Random();

        // looping for N times

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

            // generating a guassian number, adding to array

            gaussian[i] = random.nextGaussian();

            // generating a long number, adding to array

            lng[i] = random.nextLong();

        }

        // finding average and standard deviation of both array values, we can

        // use the same functions for both types

        double avgGaussian = calculateMean(gaussian);

        double sdGaussian = calculateSD(gaussian, avgGaussian);

        double avgLong = calculateMean(lng);

        double sdLong = calculateSD(lng, avgLong);

        // displaying mean and standard deviation of both, formatted to 2 digits

        // after decimal point. the gaussian values will yeild a mean value

        // close to 0 and a standard deviation close to 1

        System.out.printf("Mean of %d gaussian values: %.2f\n", N, avgGaussian);

        System.out.printf("Standard deviation: %.2f\n", sdGaussian);

        System.out.printf("Mean of %d long values: %.2f\n", N, avgLong);

        System.out.printf("Standard deviation: %.2f\n", sdLong);

   }

}

Explanation:

5 0
3 years ago
Do you think that you could create a Word document that would average and summarize these grades across the students and then ha
ASHA 777 [7]
No, Microsoft Word (or subsequent) would be the wrong Office application to complete the tasks. Excel would be perfect for such a task, as it can both work out averages and create charts. 
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which is the correct expansion of the term Internet? 
    9·2 answers
  • Done through Block Py/ Python
    11·1 answer
  • What do you need for digital photography? 1. 2. 3.
    13·1 answer
  • Adobe reader is a type of​
    14·2 answers
  • Which of the following is not a command for determining if MySQL is running on Linux (Ubuntu)?
    7·1 answer
  • Sean works for a company that ships hospital equipment. He needs to calculate the weight of the items being shipped. He enters t
    12·1 answer
  • Ivan wants to have code in a game that will make it possible to change the speed of a swimmer in the game. Which of these does I
    8·1 answer
  • Guys, if I'm going back to 505 and it's a 7-hour flight or a 45-minute drive how do I get to 505?
    12·1 answer
  • NO SPAMMERS, ONLY FULL ANSWER
    8·2 answers
  • What are the benefits and drawbacks of a desktop utilising virtualisation and a server?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!