Write a Java application that uses an array to represent a collection of at least 10 objects, and provides a user interface that gives a way to display information and/or statistics about the objects. The program should declare and instantiate an array of objects that keep information about something in the real world (such as Countries, Books, Students, etc.), and then implement JButtons that will display information from the array or statistics about the items in the array in a JTextArea.
MUFrame.form
and MUFrame.java
in the MUFrameWithGUIDesigner.zip file available on the Student Resources page of the course web site. Do NOT use an MUPanel class for this assignment -- you should only have an MUFrame class, since you are not doing any drawing.Book
class and the Student
class from Lab9, and the
Country
class used in the sample programs below. You
may not use Books, Students or Countries for your PA7; you must think up some other
class of objects to use for this assignment. toString()
method. You may also want to implement
setter methods for each of the private data items, but setters are not required for this
assignment.MUFrame
class, declare an array of your objects, and then in the constructor
method of the MUFrame
class, instantiate the array so that it contains at least
10 elements.nation[0] = new Country(some parameter values go here); nation[1] = new Country(some parameter values go here); nation[2] = new Country(some parameter values go here); ...
Country
objects in the array, and another that would find the minimum area
of any Country
. The information must be displayed in the JTextArea that is
visible in the output window.String
data member, using the
.equals
method. Either count the number of array elements that have the property
being tested, or display them in the JTextArea. In the examples below, a button can be
used to display only those countries that are located in Africa (continent.equals("Africa")).
CSC 120, PA7, your name, date & Description comments in MUFrame.java | 3 |
Class definition with at least five private data members, a constructor, and getter methods for each data member. | 7 |
Array declared and instantiated, and at least 10 elements in the array. | 3 |
JButton that displays every element in the array in a JTextArea, using a loop. | 5 |
At least two Buttons that display sum, average, min and/or max of a numeric data member for the entire array in a JTextArea, using a loop. | 12 |
At least two JButtons that test each element of the array for some property of a String data member using the .equals method in a JTextArea, using a loop. | 12 |
Your code is easy to read, and indented consistently. | 3 |
Total | 45 |