Created
October 29, 2019 18:41
-
-
Save DanCoughlin/ec921c4465955f673bd4b5f8656bc1d7 to your computer and use it in GitHub Desktop.
2D Array and Display #module5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[][] results = | |
{ | |
{"homeLabs", "1500 sq feet", "169.99", "4.6", "HME020030N"}, | |
{"Inofia", "1050 sq feet", "130.04", "4.4", "GA2"}, | |
{"Yaufey", "1500 sq feet", "159.99", "4.5", "163A"}, | |
{"homeLabs", "4500 sq feet", "204.99", "4.6", "HME020031N"} | |
}; | |
String[] labels = {"Manufacturer", "Coverage", "Price", "Avg Rating", "Model #"}; | |
for (int i=0; i < results.length; i++) { | |
System.out.printf("%15s%n", "Product " + (i+1)); | |
for (int j=0; j < results[i].length; j++) { | |
System.out.printf("%-15s %s%n", labels[j] + ":", results[i][j]); | |
} | |
System.out.println(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment