Answer to Question #281404 in Java | JSP | JSF for Netsi

Question #281404

Write a program that read four taste values for ten studens store the value in two dimensional array display the content of the array in tabular format using for loop

1
Expert's answer
2021-12-20T09:59:42-0500


import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		int tasteValues[][] = new int[10][4];


		Scanner keyBoard = new Scanner(System.in);
		for (int i = 0; i < 10; i++) {
			System.out.println("Enter four taste values for student " + (i + 1));
			for (int j = 0; j < 4; j++) {
				System.out.print("Enter taste value " + (j + 1) + ": ");
				tasteValues[i][j] = keyBoard.nextInt();
			}
		}
		System.out.printf("%-18s", "");
		for (int j = 0; j < 4; j++) {
			System.out.printf("%s%-10d", "Taste ", (j + 1));
		}
		System.out.println();
		for (int i = 0; i < 10; i++) {
			System.out.printf("%s%-10d", "Student ", (i + 1));
			for (int j = 0; j < 4; j++) {
				System.out.printf("%-16d", tasteValues[i][j]);
			}
			System.out.println();
		}


		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog