Answer the questions in this section based on the following statements:
EMPLOYEE_DETAILS [0] [0] = “John”
EMPLOYEE_DETAILS [0] [1] = “Doe”
EMPLOYEE_DETAILS [0] [2] = “0123456788”
EMPLOYEE_DETAILS [1] [0] = “Jane”
EMPLOYEE_DETAILS [1] [1] = “Doe”
EMPLOYEE_DETAILS [1] [2] = “0123569988”
Q.4.2.1 Consider the statements above, then draw a table to illustrate how the data provided will be stored in memory.
Q.4.2.2 Identify the structure employed to store the values provided at the beginning of the question. Then provide the statement that will declare the structure so that it can be used in an application.
help me with this Programming logic and design question please
java language
In case of any queries, please revert back.
By looking at the data given, we can say that This is stored in a 2D array of shape [2][3] and is of type String in JAVA.
Q 4.2.1 => In memory, if we consider a row-major Representation, we can say that the following is stored as.
MEMORY LOCATION | F_NAME | L_NAME | PHONE_NUMBER |
1000 | John | Doe | 0123456788 |
2000 | Jane | Doe | 0123569988 |
So, memory is allocated Consecutively to different blocks. If the first block takes 999 bytes space at 1000 index, next block starts at 2000-2999.
Q. 4.2.2 => This is 2D array of strings with 2 rows and 3 columns.
String[][] EMPLOYEE_DETAILS=new String[2][3];
You can use this easily using :-
EMPLOYEE_DETAILS [0] [0] = “John”
EMPLOYEE_DETAILS [0] [1] = “Doe”
EMPLOYEE_DETAILS [0] [2] = “0123456788”
EMPLOYEE_DETAILS [1] [0] = “Jane”
EMPLOYEE_DETAILS [1] [1] = “Doe”
EMPLOYEE_DETAILS [1] [2] = “0123569988”
Get Answers For Free
Most questions answered within 1 hours.