Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Messwerte_ {
- public static void main(String[] args) {
- double result = 0.0;
- double[] Arrayspeicher = {result};
- int Messwert = inputCheck();
- for (int i = 1; i <= Messwert; i++)
- {
- double upper = 27;
- double lower = -16;
- result = Math.random() * (upper - lower) + lower;
- result = Math.round(result*100.0)/100.0;
- //System.out.println("Messwert " + i + ": " + result);
- Arrayspeicher = new double[] {result};
- System.out.println("Messwert " + i + ": " + Arrays.toString(Arrayspeicher));
- }
- Arrays.sort(Arrayspeicher);
- System.out.println(Arrays.toString(Arrayspeicher));
- }
- public static int inputCheck() {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Bitte geben Sie eine Ziffer ein die höher gleich 5 und niedriger gleich 40 ist: ");
- int Messwert = keyboard.nextInt();
- System.out.println();
- while (Messwert < 4 || Messwert > 41) {
- }
- return Messwert;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement