Question: JAVA Imagine you are a border security agent for the Human Empire in the year 2 5 2 4 . You are tasked with granting

JAVA
Imagine you are a border security agent for the Human Empire in the year 2524. You are tasked with granting or denying admission to galactic visitors to Earth. All galactic nations are part of the Alliance apart from Aclaris, due to an ongoing territorial dispute about asteroid mining.
Create a class called BorderSecurity that automatically checks each visitor. For each visitor, your program must follow the decision structure as follows:
Check their nationality
If they are not a citizen of Aclaris, print "Your nationality is valid."
If they are a citizen of Aclaris, they must have a visa in order to be granted admission. Prompt the visitor for a visa (y, or n).
If they have a visa, print "You have a valid visa."
If they do not have a visa, print "You do not have a valid visa. Admission denied."
Check their passport expiration year
If their passport expiration year is greater than the current year (2524), print "You have a valid passport."
If their passport expiration year is less than or equal to the current year, print "Your passport has expired. Admission denied."
Check their age
If they are over the age of 18, print "Your age is valid."
If they are under the age of 18, they must have a guardian to be granted admission. Prompt the visitor for a guardian (y, or n).
If they have a guardian, print "You have a valid guardian."
If they do not have a guardian, print "You do not have a guardian. Admission denied."
Finally, if they passed all the checks, print "You have passed the checks. Admission granted."
The order of input matters! Do not ask for a visa or a guardian unless they have not met the nationality or age requirement respectively.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!