Question: the bolded areas are where I keep getting errors in the code. if you have a better code option please help with this question. I

the bolded areas are where I keep getting errors in the code. if you have a better code option please help with this question.

I need this In Java FX and i Want it to work in Eclipse.

Design a new parameterized ArrayList called NuArrayList. This can be achieved by implementing compositionmaking a java.util.ArrayList a data member of NuArrayList. The NuArrayList class should include two methods: min and max. This class will be used by all programmers in the company so it should be in a package called nusoft.utils.

public > E max() returns the maximum element in an ArrayList

public > E min() returns the minimum element in an ArrayList

This class NuArrayList must NOT have a main method.

Create a class to demonstrate the use of your NuArrayList class. This class will not be used by the entire company. It should not be in the nusoft.utils package. Put it in an appropriate package. This class will

1. generate at least 25 random java.lang.Integer objects, 2. add the integer objects to a NuArrayList object 3. display the contents of the NuArrayList object 4. display the minimum and maximum elements it contains 5. Repeat steps 1 - 4 using random java.lang.Character objects 6. Repeat steps 1 - 4 using random java.util.Date objects

package com.example;

import java.util.Date;

import java.util.Random;

import nusoft.utils.NuArrayList;

public class NuArrayListDemo {

public static void main(String[] args) {

// Create a new NuArrayList object

NuArrayList intList = new NuArrayList<>();

// Add 25 random Integer objects to the list

Random rand = new Random();

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

int num = rand.nextInt(100);

intList.add(num);

}

// Display the contents of the list

System.out.println("Integer List: " + intList);

// Display the minimum and maximum elements in the list

System.out.println("Minimum: " + intList.min());

System.out.println("Maximum: " + intList.max());

// Create a new NuArrayList object

NuArrayList charList = new NuArrayList<>();

// Add 25 random Character objects to the list

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

char ch = (char)(rand.nextInt(26) + 'a');

charList.add(ch);

}

// Display the contents of the list

System.out.println("Character List: " + charList);

// Display the minimum and maximum elements in the list

System.out.println("Minimum: " + charList.min());

System.out.println("Maximum: " + charList.max());

// Create a new NuArrayList object

NuArrayList dateList = new NuArrayList<>();

// Add 25 random Date objects to the list

long now = System.currentTimeMillis();

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

long time = rand.nextLong() % now;

Date date = new Date(time);

dateList.add(date);

}

// Display the contents of the list

System.out.println("Date List: " + dateList);

// Display the minimum and maximum elements in the list

System.out.println("Minimum: " + dateList.min());

System.out.println("Maximum: " + dateList.max());

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!