java program that allows the user to enter packages\' names followed by their we
ID: 3715586 • Letter: J
Question
java program that allows the user to enter packages' names followed by their weights. Use an array of String to store packages' names and an array of double to store their weights. The program then outputs the following information (assume that there are 10 packages total):
- Each package's name and the weight
- Highest weight
- The names of all the packages having the highest weight
- Average weight
- The names of all the packages whose weights are less than the average
- The names of all the packages whose weights are greater than or equal to the average
It is required to use array for this assignment (do not use ArrayList).
Explanation / Answer
import java.util.Scanner; public class PackagesAvg { public static void main(String[] args) { String[] packages = new String[10]; Double[] weights = new Double[10]; Scanner scan = new Scanner(System.in); for (int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.