Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab-Add min and max methods to a LinkedList class Part #1 : Practice with the LinkedList Design a Java class called MaxMinLL in MaxMinLL.java. It

image text in transcribed

Lab-Add min and max methods to a LinkedList class Part #1 : Practice with the LinkedList Design a Java class called MaxMinLL in MaxMinLL.java. It should have two data elements 1) Range (the range of possible integer values in the list - e.g. 0 thru 10 or 0 thru 100) Linked List 2) It should have these methods One-argument constructor (the range) No-arg constructor (should call the one-argument constructor with a default range, e.g. 10 or 100). The constructor should also populate the list with a small number of items (maybe 10 or 20). This is so you can visually scan the list quickly to check for max and min values. That would be hard to do if the list had a large number of elements. Use the Random object and make calls to Random.nextlnt to populate the list. You should pass the range into Random.nextlnt( - findMin() method that scans the list to find and return the smallest value - findMax) method that scans the list to find and return the largest value - removeMin) method to remove all copies of the smallest value (could be more than one) removeMax) method to remove all copies of the largest value (could be more than one) Include a main() method to test the object. You should print out the list first. Then call findMin) and display the smallest value, and call removeMin and show the list after the call to removeMin) Then call findMax) and display the largest value, and call removeMax) and show the list after the call to removeMax) See below for a sampe run [0, 4, 3, 0, 3, 0, 1, 9, 7, 7] findMin(): 0 removeMin(): [4, 3, 3, 1, 9, 7, 7 findMax ): 9 removeMax(): [4, 3, 3, 1, 7, 7]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

A service window closes just as they get to the front of the line.

Answered: 1 week ago