assignment2-group2-section15
assignment2-group2-section15
assignment2-group2-section15
Course
BIS 20503 Item 2/
Code
Lab 7
FACULTY OF
COMPUTER SCIENCE
Course SOFTWARE Sem / 1/
AND INFORMATION
SECURITY Session 20242025
TECHNOLOGY
Case scenario
You are involved in a UTHM New International Student Information System development
project. In the project development, your part is to design and write a code segment for the
Personal Information module, in which new students are required to enter their personal
information. As a part of security requirements, the code must apply input validation
elements.
Users (i.e. new international students) are required to enter the following information:
1. Name (must be string)
2. Date of birth (in format: dd/mm/yyyy)
3. Passport no (must be alphanumeric, start with letter and followed by digits, it must not
be more than 10 digits)
4. Home country (must be string)
5. Program code (users must enter: 1 for BIT, 2 for BIS, and 3 for BIP)
All information will be displayed after users finish entering the required information with
correct format. If there is/are any incorrect input, warning message will be displayed for
users to enter correct input. Example of output is presented in Figure 1.
a) Illustrate the input validation flow using a flowchart (refer to slide no. 62 in
Chapter 4 notes).
b) Insert the source code for the Personal Information module. (You can choose to
copy & paste the code from programming software OR screenshot the code – as
long as it is clear and visible).
import java.util.*;
if (dateOfBirth.matches("^\\d{2}/\\d{2}/\\d{4}$")) {
return dateOfBirth;
} else {
System.out.println("Error; Invalid input. Please follow the format
dd/mm/yyyy.");
}
}
};
System.out.println("\nPersonal Information:");
d) Provide a screenshot of the input that exceeds 10 digits for Passport no.
e) Provide a screenshot of the wrong input that does not enter 1, 2, or 3 for Program
Code.
• Related flowchart flow
Total /15