Question: In Java Please Program Specifications Write a program to calculate the minimum, maximum, mean, median, mode, and whether an array is a palindrome. Note: This

In Java Please
Program Specifications Write a program to calculate the minimum, maximum, mean, median, mode, and whether an array is a palindrome.
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step 0. Review the starter code in main(). An array is filled with integers from standard input. The first value indicates how many numbers are to follow and be placed in the array.
Step 1(2 pts). Use a loop to process each array element and output the minimum and maximum values. Submit for grading to confirm one test passes.
Ex: If input is:
641549917
the output is:
Minimum: 1 Maximum: 99
Step 2(2 pts). Use a loop to sum all array elements and calculate the mean (or average). Output the mean with one decimal place using System.out.printf("Mean: %.1f
", mean);. Submit for grading to confirm two tests pass.
Ex: If input is:
641549917
the output is:
Minimum: 1 Maximum: 99 Mean: 21.7
Step 3(2 pts). Use a loop to determine if the array is a palindrome, meaning values are the same from front to back and back to front. Output "true" or "false". Submit for grading to confirm three tests pass.
Ex: If input is:
9123454321
the output is:
Minimum: 1 Maximum: 5 Mean: 2.8 Palindrome: true
Step 4(1 pt). main() includes a call to Arrays.sort(), which sorts the array elements into ascending order. Do not sort the array before step 4. After sorting, identify the median. The median is located in the middle of the array if the array's length is odd. Otherwise, the median is the average of the middle two values. Output the median with one decimal place. Submit for grading to confirm four tests pass.
Ex: If input is:
6225677
the output is:
Minimum: 2 Maximum: 7 Mean: 4.8 Palindrome: false Median: 5.5
Step 5(3 pts). Challenging! Identify the mode after the array is sorted in ascending order. The mode is the value that appears most frequently. Assume only one mode exists. Hint: Use a loop to process each array element, looking for the longest sequence of identical values. Submit for grading to confirm all tests pass.
Ex: If input is:
9122233456
the output is:
Minimum: 1 Maximum: 6 Mean: 3.1 Palindrome: false Median: 3.0 Mode: 2
This is the current code I have up to step 2
import java.util.Arrays;
import java.util.Scanner;
public class LabProgram {
public static void main(String args[]){
Scanner scnr = new Scanner(System.in);
int nums[];
int count;
// Step 0: Input array values
count = scnr.nextInt();
nums = new int[count];
for (int i =0; i count; ++i){
nums[i]= scnr.nextInt();
}
// Step 1: Find and output minimum and maximum values
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
double sum =0.0;
for(int num : nums)
{
if(num min)
min = num;
if(num > max)
max = num;
sum += num;
}
System.out.println("Minimum: "+ min);
System.out.println("Maximum: "+ max);
// Step 2: Calculate and output mean
System.out.printf("Mean: %.1f
", sum / count);
// Step 3: Check if palindrome
// Sort array elements in ascending order
Arrays.sort(nums);
// Step 4: Find and output median
/* Type your code here */
// Step 5: Find and output mode
/* Type your code here */
}
}
Thank you
In Java Please Program Specifications Write a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!