The writer is very fast, professional and responded to the review request fast also. Thank you.
You will need to modify the main program to exercise all versions of the overloaded method. For the addition of two integer arguments, you need to exercise both versions of printArray on all three array types (integer, double, and character). For the non-generic version, you need to show the ability to exercise the method and print out the nicely formatted string array content.
Make sure to submit your java code file(s) and your execution screenshots. Don’t forget to include a program header with your name, section, assignment title, and a description of the program. The execution screenshots are required for credit. Make sure to submit your own original code. SafeAssign has been enabled to verify originality of code.
// Using generic methods to print array of different types.
public class GenericMethodTest
{
// generic method printArray
public static < E > void printArray( E[] inputArray )
{
// display array elements
for ( E element : inputArray )
System.out.printf( “%s “, element );
System.out.println();
} // end method printArray
public static void main( String args[] )
{
// create arrays of Integer, Double and Character
Integer[] integerArray = { 1, 2, 3, 4, 5, 6 , 7, 8, 9, 10};
Double[] doubleArray = { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7 , 8.8, 9.9, 10.1};
Character[] characterArray = { ‘I’, ‘S’, ‘2’, ‘4’, ‘7’ ,’ ‘ , ‘i’, ‘s’, ‘ ‘ , ‘f’, ‘u’, ‘n’};
System.out.println( “Array integers:” );
printArray( integerArray ); // pass an Integer array
System.out.println( “nArray doubles:” );
printArray( doubleArray ); // pass a Double array
System.out.println( “nArray characters:” );
printArray( characterArray ); // pass a Character array
} // end main
} // end class GenericMethodTest
public class InvalidSubscriptException extends RuntimeException {
// no-argument constructor
public InvalidSubscriptException() {
this(“Invalid subscript.”);
}
// one-argument constructor
public InvalidSubscriptException(String message) {
super(message);
}
// two-argument constructor
public InvalidSubscriptException(String message, Throwable cause) {
super(message, cause);
}
}
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more