Question: 9. (6 points) Write a Java program takes a positive integer n as the first command line argu 1.0 2 k i ment (that is,


9. (6 points) Write a Java program takes a positive integer n as the first command line argu 1.0 2 k i ment (that is, args [o]) and uses a for loop to calculate the sum for all odd integers i in the range 1 to n. Note: the fraction 10 should be evaluated as a double to avoid integer division. Call the program HW3Sum.java. The first line of text should be your name and the CRN number of your lab section. The second line should be the calculated sum. If the value n is non positive, print out a error message. Submit the source code (the java file) to Dropbox on Brightspace. 8. (4 points) Write a fragment of code that uses two existing arrays of doubles, a and b, creates a third array c, and assigns each element of c to the average of the corresponding elements of a and b. You may assume that the arrays a and b are the same length
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
