plz do not copy from chegg
Implement a ‘runnable’ Class called “NumericAnalyzer”. Here’s the functional behavior that must be implemented.
NOTE: Don’t prompt the user for input – this is an exercise passing values to your program via the command line! We’re forcing the user to “push” data values to the application rather than “pull” it from the user!
Odd Sized Example
2 3 4 8 12 16 32 =8 ^
Even Sized Example
1 3 4 12 16 32 =4 + 12 = 16 / 2 = 8 ^ ^
Development / solution guidelines:
NOTE: Deriving calculations and displaying output to a Console are separate threads of responsibility, and should therefore be implemented independently of each other.
So your main() method will include a sequence of instructions similar to this. Use your own ingenuity to complete:
// main() method code fragment exampleif(args.length == 0 ) {
// Display some error message … (System.err. )
System.exit(1);
}
// create an int array
int [] numbers = new int[args.length];
for(int i = 0 ; i < args.length="" ;="" ++i="" )="">
///////////////////////////
///// EXTRA CREDIT FEATURE
if(!NumericAnalyzer.isNumeric(args[i])) {
System.err.println("Expecting Numeric Data: " + args[i]);
System.exit(2); // exit code for invalid data
//////////////////////////
numbers[i] = Integer.parseInt(args[i]);
NumericAnalyzer analyzer = new NumericAnalyzer(numbers);
analyzer.analyze();
analyzer.display();
System.exit(0);
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here