a design idea
first , create a class in file and write the task name and class name (note the capitalization of the class name); The second step is the input of the parameter, and the sum variable is defined, and the third step is the requirement of the parameter data type, to convert the character type to an integer type and output (which is also the focus of this topic), This step is, of course, placed in the for loop of the input parameter, and finally the sum of the arguments and the output parameters.
two program flowchart
three source program code
Public class javaapparguments {
/**
* @param args
*/
Public Static void Main (string[] args) {
TODO auto-generated Method stub
System. out. println (" Number of parameters :"+args.length);// number of input parameters
int sum=0;
int i;
for (String Arg:args) {
I=integer. parseint (ARG); Converting a parameter data type from a character type to an integer type
System. out. println (ARG); Output Parameters
Sum=sum+i;
}
System. out. println (" and for :"+sum); output parameter's and
}
}
Imitate the Javaapparguments.java example, write a program that receives multiple numbers from the command line, sums up the output, writes out its design idea, the program flowchart, the source program code.