import java.util.*; class Corporate { public static void main(String[] args) { double salary; // double variable declared to store returning value String tempString = ""; // String array is declared to store returning value String gender = "female "; while (true) // easiest way to implement an infinite loop { tempString = ask_Name(); // calls the ask_Name function that does not // accept input parameters, and returns 1 output // parameter of type String, therefore same // type of parameter is ready to the left side of "=" sign salary = ask_Salary(); // calls the ask_Salary function that does not // accept input parameters, and returns 1 output // parameter of type double, therefore same // type of parameter is ready to the left side of "=" sign gender = determine_Gender(tempString);// calls the determine_Gender function that does // accept 1 input parameter of type String, and returns 1 output // parameter of type String, therefore same // type of parameter is ready to the left side of "=" sign // The line below is responsible for printing the statement at the end of each entering seesion // %.2f is a formatting key to ensure the printed value of salary is in fixed point notation with // 2 decimal digits after the decimal point System.out.format (tempString + " is a " + gender + " and makes PLN %.2f", salary); System.out.println(); } } public static String ask_Name () // ask_Name function does not // accept input parameters therefore nothing is in the brackets // and returns 1 output // parameter of type String, therefore same // type is declared as the type of the function { Scanner input = new Scanner(System.in); String tempString = ""; System.out.println("Please input full name of an employee"); tempString = input.nextLine(); return tempString; // return statement is needed if function is not of type VOID } public static double ask_Salary () // ask_Salary function does not // accept input parameters therefore nothing is in the brackets // and returns 1 output // parameter of type double, therefore same // type is declared as the type of the function { Scanner input = new Scanner(System.in); double salary; System.out.println("Please input person's salary"); salary = input.nextDouble(); return salary; // return statement is needed if function is not of type VOID } public static String determine_Gender(String Name) // determine_Gender function does // accept 1 input parameter (Name) of type String // therefore it is defined in the brackets // and returns 1 output // parameter of type String, therefore same // type is declared as the type of the function { String gender; if ( Name.endsWith("a")) { gender = "female "; } else { gender = "male "; } return gender; // return statement is needed if function is not of type VOID } }