Question: java program Q1. [5 pts] Write class Citizen which has Five instance variables: - name: String - civillD: String - dateOfBirth: Date - expirationDate: Date

Q1. [5 pts] Write class Citizen which has Five instance variables: - name: String - civillD: String - dateOfBirth: Date - expirationDate: Date - currentDate: Date This is static/final and set to today's date. Class Date is provided for you, so you do not need to implement it. Your Citizen class should have: - A constructor that initializes the name, civillD, dateOfBirth, expirationDate. - A second constructor that takes 0 arguments and initializes name and civillD to "N/A"; and initializes the dateOfBirth (day, month, and year) (of class Date) to 1,1, 2000, respectively, and finally the expirationDate to 1,1,3000. - A third constructor that takes only name and civillD, initializes the dateOfBirth day, month, and year to 1,1,2000, and initializes expirationDate to 1,1,3000 respectively. - set and get methods for all your instance variables with valid values. The class also should include methods that: 1. checkExpiration: check the object's expiration has occurred (need to check current date for this) and print a statement that alerts the user. Write another class called CitizenTest that includes the main method. Your main should do the following: - Print the Current Date at the top of the console. - Create an array of type Citizen with a size of 5. - Create each object of the array manually and initialize it as follows: Array element 0 : When you create the object, pass to the constructor 0 parameters Array element 1: pass to the constructor only: "Ahmed". "299060700244" Array element 2: pass to the constructor: "Sara","298060300744",6,3,1998,6,3,2026 Array element 3: pass to the constructor: "Noura", "290170500284",17,5,1990, 18,5,2030 Array element 4: pass to the constructor: "Ali", "295200100994",20,1,1995, 21,1,2020 - Finally, use a for loop to go through each element of the array and print the name and date of birth (use the method formattedDate from the class Date to get the date of birth in a formatted string). Hint: use "import java.time.LocalDateTime;" and the variable of the class called "LocalDateTime" assigned to "LocalDateTime.now()" with methods ".getDayOfMonth(), ..getMonthValue(), ..getYear()" to get the day/month/year format for today's date. Your output should look exactly as shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
