public class DataTypesDemo {
    public static void main() {
        // Create an instance of the DataTypesDemo class
        DataTypesDemo demo = new DataTypesDemo();

        // Demonstrate Primitive Data Types
        System.out.println("Demonstrating Primitive Data Types:");
        demo.demonstratePrimitives();

        // Demonstrate Reference Data Type (String)
        System.out.println("\nDemonstrating Reference Data Type (String):");
        demo.demonstrateString();

        // Perform Arithmetic Expressions with Casting
        System.out.println("\nPerforming Arithmetic Expressions with Casting:");
        demo.arithmeticWithCasting();

        // Perform Compound Assignment Operation
        System.out.println("\nPerforming Compound Assignment Operation:");
        demo.compoundAssignment();
    }

    // Primitive Data Types: int, double, boolean
    public void demonstratePrimitives() {
        // Integer (int) data type
        int intValue = 10;
        System.out.println("Integer value: " + intValue);

        // Double data type
        double doubleValue = 3.14;
        System.out.println("Double value: " + doubleValue);

        // Boolean data type
        boolean boolValue = true;
        System.out.println("Boolean value: " + boolValue);
    }

    // Reference Data Type: String
    public void demonstrateString() {
        // String data type
        String name = "John";
        System.out.println("Hello, " + name + "!");
    }

    // Perform Arithmetic Expressions with Casting
    public void arithmeticWithCasting() {
        int intValue = 5;
        double doubleValue = 2.5;

        // Casting int to double
        double convertedValue = (double) intValue;
        System.out.println("Converted value: " + convertedValue);

        // Arithmetic expression with casting
        double result = convertedValue * doubleValue;
        System.out.println("Result of arithmetic expression: " + result);
    }

    // Perform Compound Assignment Operation
    public void compoundAssignment() {
        int intValue = 10;
        intValue += 5; // Increment by 5
        System.out.println("Updated integer value: " + intValue);
    }
}

DataTypesDemo dataTypes = new DataTypesDemo();
dataTypes.main();

Demonstrating Primitive Data Types:
Integer value: 10
Double value: 3.14
Boolean value: true

Demonstrating Reference Data Type (String):
Hello, John!

Performing Arithmetic Expressions with Casting:
Converted value: 5.0
Result of arithmetic expression: 12.5

Performing Compound Assignment Operation:
Updated integer value: 15
import java.util.Arrays;

public class StatisticsDemo {

    public static void main() {
        // Create an instance of the StatisticsDemo class
        StatisticsDemo demo = new StatisticsDemo();

        // Generate 20 data points and store them in an array
        double[] dataPoints = { 12.5, 7.8, 14.2, 18.9, 22.0, 9.6, 11.0, 16.7, 5.3, 30.1, 19.8, 25.4, 8.0, 13.2, 21.7, 6.5, 10.3, 27.6, 15.0, 33.7 };

        // Display the data
        System.out.println("Data Points:");
        demo.displayData(dataPoints);

        // Calculate and display statistics
        System.out.println("\nStatistics:");
        System.out.println("Minimum: " + demo.calculateMinimum(dataPoints));
        System.out.println("Q1 (First Quartile): " + demo.calculateQ1(dataPoints));
        System.out.println("Standard Deviation: " + demo.calculateStandardDeviation(dataPoints));
        System.out.println("Mean: " + demo.calculateMean(dataPoints));
        System.out.println("Median: " + demo.calculateMedian(dataPoints));
        System.out.println("Q3 (Third Quartile): " + demo.calculateQ3(dataPoints));
        System.out.println("Maximum: " + demo.calculateMaximum(dataPoints));
    }

    // Generate 'count' random data points between 0 and 100
    public double[] generateDataPoints(int count) {
        double[] dataPoints = new double[count];
        for (int i = 0; i < count; i++) {
            dataPoints[i] = Math.random() * 100;
        }
        return dataPoints;
    }

    // Display an array of data points
    public void displayData(double[] dataPoints) {
        for (double dataPoint : dataPoints) {
            System.out.print(dataPoint + " ");
        }
        System.out.println();
    }

    // Calculate the minimum value in the data set
    public double calculateMinimum(double[] dataPoints) {
        return Arrays.stream(dataPoints).min().orElse(Double.NaN);
    }

    // Calculate the first quartile (Q1) of the data set
    public double calculateQ1(double[] dataPoints) {
        Arrays.sort(dataPoints);
        int n = dataPoints.length;
        int index = n / 4;
        return dataPoints[index];
    }

    // Calculate the standard deviation of the data set
    public double calculateStandardDeviation(double[] dataPoints) {
        double mean = calculateMean(dataPoints);
        double sumSquaredDifferences = 0;

        for (double dataPoint : dataPoints) {
            double diff = dataPoint - mean;
            sumSquaredDifferences += diff * diff;
        }

        double variance = sumSquaredDifferences / (dataPoints.length - 1);
        return Math.sqrt(variance);
    }

    // Calculate the mean (average) of the data set
    public double calculateMean(double[] dataPoints) {
        return Arrays.stream(dataPoints).average().orElse(Double.NaN);
    }

    // Calculate the median of the data set
    public double calculateMedian(double[] dataPoints) {
        Arrays.sort(dataPoints);
        int n = dataPoints.length;

        if (n % 2 == 0) {
            // If the number of data points is even, average the middle two values
            int middleIndex1 = n / 2 - 1;
            int middleIndex2 = n / 2;
            return (dataPoints[middleIndex1] + dataPoints[middleIndex2]) / 2.0;
        } else {
            // If the number of data points is odd, return the middle value
            int middleIndex = n / 2;
            return dataPoints[middleIndex];
        }
    }

    // Calculate the third quartile (Q3) of the data set
    public double calculateQ3(double[] dataPoints) {
        Arrays.sort(dataPoints);
        int n = dataPoints.length;
        int index = 3 * n / 4;
        return dataPoints[index];
    }

    // Calculate the maximum value in the data set
    public double calculateMaximum(double[] dataPoints) {
        return Arrays.stream(dataPoints).max().orElse(Double.NaN);
    }
}

StatisticsDemo statsDemo = new StatisticsDemo();
statsDemo.main();

Data Points:
12.5 7.8 14.2 18.9 22.0 9.6 11.0 16.7 5.3 30.1 19.8 25.4 8.0 13.2 21.7 6.5 10.3 27.6 15.0 33.7 

Statistics:
Minimum: 5.3
Q1 (First Quartile): 10.3
Standard Deviation: 8.211947329797507
Mean: 16.465
Median: 14.6
Q3 (Third Quartile): 22.0
Maximum: 33.7