Answer to Question #259660 in Software Engineering for doeboy

Question #259660

write a java application and use two dimensional array that will store five information technology courses , with the average amount of students registered for each course


1
Expert's answer
2021-11-01T08:28:26-0400


public class App {


	public static void main(String[] args) {
		String[] regNames = { "COURSE", "REGISTRATION 1", "REGISTRATION 2", "REGISTRATION 3" , "TOTAL","DELIVER COURSE" };
		String[] courseNames = { "Programming 101", "Web Dev 101", "Databases 101", "Logic 101", "Management 101" };
		int[][] scores = { { 50, 10, 50 }, { 10, 50, 20 }, { 10, 10, 20 }, { 10, 7, 5 }, { 30, 10, 50 } };
		int[] totalForCourse = { 0, 0, 0 };
		int[] totalForStudent = { 0, 0, 0,0,0 };
		for (int i = 0; i < regNames.length; i++) {
			if (i == 0) {
				System.out.printf("%-27s ", regNames[i]);
			} else {
				System.out.printf("%-28s ", regNames[i]);
			}
		}
		System.out.println();
		for (int i = 0; i < scores.length; i++) {
			System.out.printf("%-27s ", courseNames[i]);
			for (int j = 0; j < scores[i].length; j++) {
				System.out.printf("%-28s ", scores[i][j]);
				totalForCourse[j]+=scores[i][j];
				totalForStudent[i]+=scores[i][j];
			}
			System.out.printf("%-28s ", totalForStudent[i]);
			if(totalForStudent[i]>=70) {
				System.out.printf("%-18s ", "Yes");
			}else {
				System.out.printf("%-18s ", "No");
			}
			System.out.println();
		}


		System.out.printf("%-27s ", "TOTAL");
		for (int i = 0; i < totalForCourse.length; i++) {
			System.out.printf("%-28s ", totalForCourse[i]);
		}
	}


}

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
APPROVED BY CLIENTS