Answer to Question #219817 in Java | JSP | JSF for Poly

Question #219817

Create an array that receives [ name, surname, gender, age]

o Prompt user to enter those variables.

o Display list of users

Headings

• Name | Surname | Gender | Age

o Make use of For loop to run prompt and display your array.


1
Expert's answer
2021-07-22T18:35:08-0400
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		System.out.println("Hello World");
		String arr[]= new String[4];
		Scanner in =new Scanner(System.in);
		System.out.println("Enter name, surname, gender, age: ");
		for(int i=0;i<4;i++){
		    arr[i]=in.next();
		}
		
		System.out.println("Name | Surname | Gender | Age: ");
		for(int i=0;i<4;i++){
		    System.out.print(arr[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