Question: Please answer me ASPS The following program is supposed to display the average of five command-line integer arguments, but it doesn't display the correct value.
Please answer me ASPS
The following program is supposed to display the average of five command-line integer arguments, but it doesn't display the correct value. public static void main (String[] args) { int sum = Integer.parseInt(args[0]); sum += Integer.parseInt(args[1]); sum += Integer.parseInt(args[2]); sum += Integer.parseInt(args (3]); sum += Integer.parseInt(args [4]); double average = sum/5; System.out.println(average); } Answer the following questions: (1) What is the problem with this program? (2) How to fix this code in order for it to display the average of the five command line integer arguments
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
