Design idea: The main command line is the conversion of parameters and add output. Because command-line arguments are strings, you need to convert to the add operation, and with The example Javaapparguments.java you can do a good conversion, and then the addition is done.
Program Flowchart:
SOURCE program code:
Import Java.util.scanner;public class Javaapparguments {public static void main (string[] args) {/*scanner in = new Scann ER (system.in); int i=in.nextint (); String arr[]=new string[i];for (int j=0;j<arr.length;j++) {arr[j]=in.next ();} */int sum=0; System.out.println ("Number of arguments:" +args.length); for (String Arg:args) { //for enhancement? System.out.println (ARG); Sum=sum+integer.parseint (ARG);} System.out.println ("The sum of parameters" +sum);}}
Results:
Course Assignment 01 Mimics the Javaapparguments.java example, writing a program that receives multiple numbers from the command line, and then outputs the results after summing.