Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 argumentsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started