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

Question #219966

Create a function that receives two arguments namely (age, name, gender)

return age, name, then create an if statement outside to check if the user is

above 18 years …. Display “Hi Meyer (Gender) here “F or M”, you are above

18,” else return false

o Your program should prompt a user to enter age, name and gender.

o Age should be declared as integer/number, name and gender should

be a string. Should accept gender as a full string “Female or Male”

then display only letter F or M.


1
Expert's answer
2021-07-24T07:06:14-0400
/******************************************************************************
Design an algorithm and flowchart for reading the five Vendors Name, Age, Location and


print these details on the screen.


*******************************************************************************/
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		//int [] venders=new int[5];
		String [] a=new String[3];
		Scanner in=new Scanner(System.in);
		for(int i=0;i<5;i++){
		    System.out.println("Enter details of vender "+(i+1)+": ");
		    System.out.println("Enter Name, Age, Location:");
		    for(int j=0;j<3;j++){
		        a[j]=in.next();
		    }
		}
		for(int i=0;i<5;i++){
		    System.out.println("Details of vender "+(i+1)+": ");
		    System.out.println("Name\t Age\t Location:");
		    for(int j=0;j<3;j++){
		        System.out.print(a[j]+" \t");
		    }
		    System.out.println();
		}
	}
}

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