I need to print the following array and am not sure how to do so. It uses an object which is already created named TimeAT....
i
mport java.util.Scanner;
import java.util.Random;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Cory
*/
public class hw6Main
{
public static void main(String [] args)
{
final int arrayNumber;
// Create Scanner object
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the size of the array: ");
arrayNumber = keyboard.nextInt();
if (arrayNumber < 5 || arrayNumber > 100)
System.out.println("Invalid input amount");
TimeAT[] time = new TimeAT[arrayNumber];
getItems(time);
}
private static void getItems(TimeAT[] time)
{
int hours;
int minutes;
for (int index = 0; index < time.length; index++)
{
Random randomNumbers = new Random();
hours = randomNumbers.nextInt();
minutes = randomNumbers.nextInt();
System.out.println();
time[index] = new TimeAT(hours, minutes);
System.out.println();
}
}
}