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.
/******************************************************************************
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();
}
}
}
Comments
Leave a comment