Lab2: Week of Jan 9-14
 



Assignment 1:
Following program generates a random integer number. Modify this program to generate three random numbers between -100 and 100, and arrange them in increasing order.
Note: You can safely ignore first four lines of this program. Just keep them as it is!

import java.util.Random;
class assign1{
    public static void main(String args[]){
        Random random = new Random();
        int m; //declare an integer variable
        m = random.nextInt(); //assign a randomly generated integer value to m
    }
}

Assignment 2:
Following program generates a random real number between 0 and 1. Modify this program such that it generates a number and outputs whether the number is in the first, second, third or the fourth quarter.

import java.util.Random;
class assign2{
    public static void main(String args[]){
        Random random = new Random();
        double m;
        m = random.nextDouble();
    }
}

Assignment 3:
Write a program which randomly generates 5 real numbers and outputs the minimum number.

Assignment 4:
Write a program which randomly generates an integer number and outputs whether it is multiple of 2, 3, or 5.