Write a Java program that takes all the lines input to standard input and writes them to standard output in reverse order. That is, output each line in the reverse order of input.

Given an array of type double, write a Java program that will calculate the average of all the non-negative numbers in the array, zero inclusive, and return zero otherwise. Your program should also check for any possible errors and throw an exception, if any.

Guidelines:

  • Provide screen shots of your sample inputs and outputs.
  • Average is the sum of numbers divided by the total number of numbers.
  • You may need to count the number of non-negative entries in the array.
  • See java.lang.Exception class.
  1. Construct a Java program to clone a two-dimensional array of float entries to another two-dimensional array of similar type and size. Your program should also check for any possible errors and throw an exception, if any.

Guidelines:

  • Provide screen shots of your sample inputs and outputs.
  • Use java.util.Scanner class to read input.
  1. Write a Java program that takes all the lines input to standard input and writes them to standard output in reverse order. That is, output each line in the reverse order of input.

Guidelines:

  • Provide screen shots of your sample inputs and outputs.
  • Figure 1 depicts the input and output solution of the reverse order program.
  • Use java.util.Scanner class to read input.
  1. Construct a Java program that will rearrange an array of int values so that all the even values appear before all the odd values in the order they appear. Your program should also check for any possible errors and throw an exception, if any.

Guidelines:

  • Provide screen shots of your sample inputs and outputs.
  • Figure 2 depicts the input and output solution to the array rearrangement program.