cd to change
to the correct folder. Use java Average num1 num2 ... to run the program.
orH:, and then cd H:\class\p20a.1\.
Use java Average num1 num2 ... to run the program.
Z>java Average 1 2 3 4 5 The average is 3.0 Z>java Average 5 6 7 The average is 6.0 Z>java Average 1.1 2.3 5.6 9.02 -2 5.7 The average is 3.6199999999999997 Z>java Average Usage: Average num1 num2 .... calculates the average of the numbers Z>java Average 2.3 3.7 5.6 9.1 The average is 5.175 |
java Average 1.3 a b 4.5.)
args.length is the number of arguments. Double.parseDouble("17.355") return the double represented by
the string "17.355" i.e. it returns 17.355 (as a number). /** Name: Charles Li * Student ID : 000 000 000 * PIC ID: ccli * E-mail: ccli@math.ucla.edu * Discussion: 1A, Baber * Assignment: hw1 * * I, Charles Li, pledge that this is my own independent work, which * conforms to the guidelines of academic honesty as described in the course * syllabus. * */