Answer to Question #289399 in Programming & Computer Science for Joy

Question #289399

Using Loop Statement, create a program that will be able to display student information such as, last name, first name, middle name, address.



Sample output:



Enter number of student: 2



Enter Last name: Sinco


Enter First name: Eddiemar


Enter Middle name: Garcia


Enter Address: Cabugao




Student 1


Name: Eddiemar Garcia Sinco


Address: Cabugao




Enter Last name: Sinco


Enter First name: Kent


Enter Middle name: Tiongson


Enter Address: Cabugao



Student 2:


Name: Kent Tiongson Sinco


Address: Cabugao




1
Expert's answer
2022-01-21T13:15:06-0500
import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);


		System.out.print("Enter number of student: ");
		int N = keyBoard.nextInt();


		keyBoard.nextLine();
		for (int i = 0; i < N; i++) {
			System.out.print("Enter Last name: ");
			String lastName = keyBoard.nextLine();
			System.out.print("Enter First name: ");
			String firstName = keyBoard.nextLine();
			System.out.print("Enter Middle name: ");
			String middleName = keyBoard.nextLine();
			System.out.print("Enter Address: ");
			String address = keyBoard.nextLine();


			System.out.println("\nStudent " + (i + 1));
			System.out.println("Name: " + firstName + " " + middleName + " " + lastName);
			System.out.println("Address: " + address+"\n\n");
		}
		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
APPROVED BY CLIENTS