QuestionQuestion

1.The class Application has instance variable (field), personalIdNo that is used to store an applicant's personal identification number.
Identify the conditions a personalIdNo.value must satisfy for it to be considered a valid personal identification number.
For each condition identified, write a function that returns a boolean to indicate whether an object's personalIdNo satisfies the condition identified.
Write a function isValidPersonalIdNo that utilises the previous functions, and returns true if personalIdNo is considered valid and false otherwise.

2.The number of forenames an applicant might have is unknown, hence it is decided to store information relating to an individual applicant in an ArrayList field of type String called student. Write code to declare and instantiate the collection student.

3.The collection student is to be associated with a field personalIdNo, the personal identification number, using another collection called applications. This collection is to be accessible from any Application object. Consider the various collections you have encountered and identify one that might be used to ensure a personal identification number is used only once. Explain your choice of collection. Write code to declare and instantiate this collection.

4.Write Application methods
getSurname to return the surname of applicant;
addForename that takes a single String parameter called forename and adds forename to at least one entry in the ArrayList student.
addLogin that takes no parameter and takes the first character of each forename and the first character of the surname contained in student and adds a random number in the range 1 to 999 to form a login which is then added as the final entry to the student collection. A record is kept of all such logins created in a further collection, accessible from any Application object, called loginsIssued. This is then used to ensure that each login assigned is unique.
removeApplicant to remove an applicant identified by a valid personalIdNo from the applications collection. The method should report in the terminal window if personal identification number does not exist or conversely that the applicant's record has been successfully removed.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.ArrayList;
import java.util.Random;
public class Application
{
    private String personalIdNo;
    private ArrayList<String> student;
    private String Surname;
    public String loginsIssued;
    public Application() {
    }

    public Application(String personalIdNo, String Surname) {
       this.personalIdNo = personalIdNo;   
       this.Surname = Surname;
}

    boolean is4digit(){
       if (personalIdNo.length() == 4) {
            return true;
       }
       return false;...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats