To all. Stay CoronaVirus Free. ~Blue
Welcome to ANSWEROLOGY RELOADED, where you can ask questions and receive answers from other members of the community. ~Bluegenel
Members Online: 1
Active Members this hour:
Visits Today: 38,320
Visits Yesterday: 46,870













































0 votes
20 views

Create a java file containing the public class called “Problem1”. In the same file, create another
class called “Numbers” which will contain the following data members:
i. An integer variable called “count”.
ii. An integer array called “nums” with the capacity of storing 1000 integers. The variable
“count ” will be used for keeping track of the numbers in the array added by you.
Note that these data members can only be accessed by the methods inside the “Numbers” class.
This class will have the following public methods.
i. addArray. This method will take an integer array as a parameter and will store the
elements from the parameter array to the remaining space of the “nums” array. Note
that if the number of elements in the parameter array is more than the current capacity
of the “nums” array, show a reasonable message to demonstrate that the “nums” array
does not have the capacity to store all the elements from the parameter array. In this
case, you do not need to store any element from the parameter array to the nums
array. Otherwise, store the elements from the parameter array to the remaining space
of the nums array sequentially. You also need to update the count variable so that it
contains the total number of elements you have stored so far in the nums array. As you
will update the nums array by adding elements, the count variable will gradually grow
higher and the capacity of the array will decrease. Remember that the nums array can
contain at most 1000 elements.
ii. addData. This method will take an integer number as a parameter and will add that
number at the end of the existing elements in the “nums” array. The count variable
should be updated accordingly. While adding data, if you previously did not store any
elements in the array, the data you are going to add should be the first element in the
nums array. Just before adding the data, you should check if the nums array is full. If the
nums array is full you should not add the data element and print a relevant message.
iii. getCount. This method will return the current value in the count variable.
iv. findMin. This method will find the minimum of the numbers currently stored in the
nums array and will print it with a relevant message.
v. findMax. This method will find the maximum of the numbers currently stored in the
nums array and will print it with a reasonable message.
vi. findAvg. This method will find the average of all the elements stored in the nums array.
The average will likely be a floating-point number. Print the average with a relevant
message.
vii. findSecondMin. This method will find the second-lowest element in the nums array. You
must not apply any sorting algorithm to implement this method. For example, if the
nums array contains the following elements: 5 6 5 7 8 8 2 2 2 2 2 9 1 1 1 7, the second

the lowest element in the array is 2. Obviously, the first lowest element (i.e., the minimum
number) in the array is 1.
In the main method of the “Problem1” class, create an object of the “Numbers” class and call
the above methods through that object to insert data elements in the nums array and find the
count, maximum, minimum, average, and second minimum of the current array elements.

in Education by (50 points)

2 Answers

+1 vote

I thought that java was the stuff you drank, made out of roasted beans.  I take mine black.

Serously, i know it is a language, but don't write it.  

Good luck.

by (1,471,610 points)
+1 vote

You've got months if not years of studying there mate.

by (3,924,891 points)
[ contact us ]
[ richardhulstonuk@gmail.com ]

[ F.A.Q.s ]

[ Terms and Conditions ]

[ Website Guidelines ]

[ Privacy Policy and GDPR ]

[ cookies policy ]

[ online since 5th October 2015 ]

...