Generics enable you to specify the exact type that will be stored in a collection and give you the benefits of compile-time type checking—the compiler issues error messages if you use inappropriate types in your collections. Once you specify the type stored in a generic collection, any reference you retrieve from the collection will have that type. Instructions Write a program that inserts 25 random integers from 0 to 100 in order into Java’s LinkedList object (you must use Java’s LinkedList class to get any credit for this assignment).   The program must: sort the elements, then calculate the sum of the elements, and calculate the floating-point average of the elements.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question

Generics enable you to specify the exact type that will be stored in a collection and give you the benefits of compile-time type checking—the compiler issues error messages if you use inappropriate types in your collections. Once you specify the type stored in a generic collection, any reference you retrieve from the collection will have that type.

Instructions

Write a program that inserts 25 random integers from 0 to 100 in order into Java’s LinkedList object (you must use Java’s LinkedList class to get any credit for this assignment).

 

The program must:

  • sort the elements,
  • then calculate the sum of the elements, and
  • calculate the floating-point average of the elements.

 

For this assignments make sure that your screen shot(s) show your program running and that your runtime display shows your random list, sorted list, sum of the elements, and average of the elements.  You only get credit for what you demonstrate.  Below is a sample screen shot.  Your output doesn’t have to look exactly like this but you should display the unsorted list, the sorted list, the sum, and the average to get full credit.

 

 

 

Expert Solution
Step 1

Introduction

Java programming:

 Java is cross-platform, meaning it can run on any operating system, and is relatively easy to learn. It is a versatile language that has powerful tools for creating efficient and secure applications. It is used in a variety of applications, from desktop applications to web development, mobile development, and embedded systems. Java is popular for its scalability and support for a wide range of libraries and tools.

 

To find:

Program that inserts 25 random integers from 0 to 100.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Operations of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT