Question: java programming 1. Input 10 integers from the keyboard and store them into an array, write a program to satisfy the following requirements: (10') (1).
1. Input 10 integers from the keyboard and store them into an array, write a program to satisfy the following requirements: (10') (1). Provide a Mathematics Class which has 3 static methods: (5') I. Prototype: public static int add(int// array) Sum the items in an array, and the return keeps the result. II. Prototype: public static void sortArray(int// array, boolean flag) Sort the items in an array by the flag: if the flag is true, sort the array in an ascending order; if the flag is false, sort the array in a descending order. III. Prototype: public static void printArray(int// array, boolean flag) Print the items in an array by the flag: if the flag is true, print the items in the array in a positive sequence; if the flag is false, print the items in the array in a reverse order. (2). Output the data in the array in the reverse order; (1') (3). Sort the data in the array in the ascending order; (1') (4). Calculate the sum and the average of these integers. (1') (5). Requirements of (2) (4) must use the static methods defined in class Mathematics to demonstrate their functions. (2')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
