Programming Activity 8.4

Hi, this is Bndsbon. Today I am going to talk about Programming Activity 8.4, which is part of the exercises we currently have in the textbook. The activity is going to include the knowledge of ArrayList and GUI. Without Further due, let’s get started!

Here are the requirements for this activity from the textbook:

Screen Shot 2017-06-27 at 5.01.41 PM.png

Screen Shot 2017-06-27 at 5.10.20 PM.png

Here is how the program looks like when the class is first opened.

Here is how the fillValues method code looks like:

Screen Shot 2017-06-29 at 4.20.13 PM.png

Noting that the for loop will be used in similar ways in the methods and exercises below.

Here is how the program looks like after a for loop is put into the method printarray():

Screen Shot 2017-06-29 at 4.26.04 PM.png

After writing the setting value method (using a for loop again) and running the program, the values were set one by one as indicated by the diagrams below:

Screen Shot 2017-06-29 at 4.28.43 PM.png

Screen Shot 2017-06-29 at 4.28.47 PM.png

For the count frequency method, I used a for look and a if statement to ensure that the program runs just as expected with in the array length and equal to the array values:

Screen Shot 2017-06-29 at 4.33.19 PM.png

The program then searches the input frequency and gives the number of frequency out as indicated in the picture above.

Then use a for loop and a if statement in the find minimum method, the program is now able to find the minimum within the numbers provided and give the results printed in a message dialog box. The program finds the minimum by comparing every data in the program and put the smaller data to be the minimum.

Screen Shot 2017-06-29 at 4.38.06 PM.png

 

All in all, this program is actually pretty meaningful to our real life. It help us to understand how to use arraylist and how to find values, frequencies, and minimum within. With similar manipulations, this code and methods used in this program could also apply to a situation of a banking account system, where transfers have been made.

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑