Java - Assignment 04 (100 pts)
Instructions
- Write each exercise in its own method. Uncomment the function calls in main() to activate each
exercise. Refer to "Assignment01" if necessary.
- For each exercise, use comments to write pseudocode with at least one additional refinement
step. Include the pseudocode at the beginning of each method.
- Submit only one file containing all of your code. Multiple files not allowed!
- The knowledge required for this assignment is in the textbook / slides and your notes. You are
not allowed to use any additional resources, websites, external help... Doing so will be
considered plagiarism and / or cheating! If you need help, talk to a CIS tutor or to the professor.
- But you are allowed to assist your friends during the lab session in the presence of the professor.
- If you are having problems unrelated to the assignment (for example, you are unable to find a
specific function in your IDE, …), you can go ahead and check it on the Internet.
- Do not use functions/techniques that have not been covered in class yet. Doing so might be
mistaken for plagiarism and/or defeats the purpose of the exercise and will be graded 0.
- You are required to perform at least one submission at the end of the lab session, even if it’s
incomplete. You can complete it later and resubmit it; the latest one will be graded.
- Test all your methods at least 3 times in main() by calling them with different parameters
Exercise 01 (25 pts)
Write a method public static void distinct(int[] arrNumbers) that receives an array
of ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly
one space (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read a number from
the input array and store it in a local array if it is new. If the number is already in the local array, ignore
it.) At the end, the local array will contain the distinct numbers. Here is a sample run of the program:
(assuming that the input array contains 1 2 3 2 1 6 3 4 5 2)
The number of distinct number is 6
The distinct numbers are: 1 2 3 6 4 5
Exercise 02 (30 points)
Use the following formula to compute the standard deviation of n numbers:
标签:function,deviation,Java,number,numbers,array,your,mean From: https://www.cnblogs.com/qq99515681/p/18251698