Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please implement this code in java today. Please write the code for all the invalid inputs without any exceptions, thank you should print the Specification:
Please implement this code in java today. Please write the code for all the invalid inputs without any exceptions, thank you
should print the Specification: Write a program (AppleOrange, that lives in AppleOrange.java). This numbers from 1 to X (inclusive), space separated, but for multiples of 3 print "apple" instead of the number, for multipl of 7 print "orange" instead of the number, and for the multiples of both 3 and 7 print appleorange" (no space) instead o the number. X is a command line argument to the program. Don't forget to document as you go. Example program run (coloring added for readability): program > java AppleOrange 10 1 2 apple 4 5 apple orange 8 apple 10 > java AppleOrange 25 1 2 apple 4 5 apple orange 8 apple 10 11 apple 13 orange apple 16 17 apple 19 20 appleorange 22 23 apple 25 > java AppleOrange 50 1 2 apple 4 5 apple orange 8 apple 10 11 apple 13 orange apple 16 17 apple 19 20 appleorange 22 23 apple 25 26 apple orange 29 apple 31 32 apple 34 orange apple 37 38 apple 40 41 appleorange 43 44 apple 46 47 apple orange 50 Checking for Invalid Input should print the following (exactly) if the command line argument is missing, if the argument is not a Your program positive number, or if too many arguments are given. This message should be sent to System.err not System.out. Example commands which generate this error: > java AppleOrange > java AppleOrange 0 > java AppleOrange 1 1 > java AppleOrange apple Error message: Error message: as a command line argument. One positive number required Example Usage: java AppleOrange [number]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started