Write a Java class DemoList, the class has: a private attribute list1 as an ArrayList of Integer. Zero argument constructor that create and initilaise list1 to an empty list. A method fill(), which take no argument and return no values. The method should allow the user to read the list of integers: user should be prompted, to enter a series of integers one at a time, until the user enters 0. Those values are used to fill list1. A method sortList() that return the sorted list1. A method brint(): that print contents of list1. A method maximum() that returns maximum of list1. A method average that returns average of list1. A method median() that return median of lsit1 as follows: If the number of elements are odd then the median is the middle one in the sorted list If the number of elements is even, the median is the average of the middle two elements. For example: the median of 1, 2, 2, 3, 5 is 2, then middle element. The median of 1, 2, 2, 3, 4, 5, is 2.5 the average of the two middle values 2 and 3. Write a Java class TestDemoList, that has a main method to do the followings: Create an object of DemoList class call it dl. Call a proper method to fill dl with data. Call a proper method to print content of dl. Call a proper method to print content of dl after sorting it. Call a proper method to print the maximum in dl. Call a proper method to print the average of dl. Call a proper method to print the median of dl.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question

Write a Java class DemoList, the class has:
a private attribute list1 as an ArrayList of Integer.
Zero argument constructor that create and initilaise list1 to an empty list.
A method fill(), which take no argument and return no values. The method should allow the user to read the list of integers: user should be prompted, to enter a series of integers one at a time, until the user enters 0. Those values are used to fill list1.
A method sortList() that return the sorted list1.
A method brint(): that print contents of list1.
A method maximum() that returns maximum of list1.
A method average that returns average of list1.
A method median() that return median of lsit1 as follows:
If the number of elements are odd then the median is the middle one in the sorted list
If the number of elements is even, the median is the average of the middle two elements.
For example: the median of 1, 2, 2, 3, 5 is 2, then middle element. The median of 1, 2, 2, 3, 4, 5, is 2.5 the average of the two middle values 2 and 3.
Write a Java class TestDemoList, that has a main method to do the followings:
Create an object of DemoList class call it dl.
Call a proper method to fill dl with data.
Call a proper method to print content of dl.
Call a proper method to print content of dl after sorting it.
Call a proper method to print the maximum in dl.
Call a proper method to print the average of dl.
Call a proper method to print the median of dl.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Adjacency Matrix
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning