You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// method to evaluate the test result
public int[] evaluateResult() {
int[] resultArray = new int[25];
for (int i = 0; i < 25; i++) {
if (keyArray[i] == answerArray[i]) {
resultArray[i] = 1;
}
}
return resultArray;
}
// method to generate the Driver License Number
public String generateDriverLicenseNumber() {
Random random = new Random();
StringBuilder licenseNumber = new StringBuilder();
for (int i = 0; i < 8; i++) {
licenseNumber.append(random.nextInt(10));
}
return licenseNumber.toString();
}
// method to convert the resultArray to a string
public String getResultString(int[] resultArray) {
// method to convert the answerArray to a string
public String getAnswerString() {
StringBuilder answerString = new StringBuilder();
for (int i = 0; i < 25; i++) {
answerString.append(answerArray[i]).append(" ");
}
return answerString.toString();
}
// toString method to display the test result
public String toString() {
int[] resultArray = evaluateResult();
return getResultString(resultArray);
}
}
The text was updated successfully, but these errors were encountered:
import java.util.Random;
import java.time.LocalDate;
public class SP2024_DriverLicenseCandidate_Dahal {
private String candidateName;
private String SSNumber;
private String address;
private char[] keyArray;
private char[] answerArray;
// no-argument constructor
public SP2024_DriverLicenseCandidate_Dahal() {
this.keyArray = new char[25];
this.answerArray = new char[25];
}
// parameterized constructor
public SP2024_DriverLicenseCandidate_Dahal(String candidateName,String SSNumber, String address, char[] answerArray) {
this.candidateName = candidateName;
this.SSNumber = SSNumber;
this.address = address;
this.keyArray = new char[25];
this.answerArray = answerArray;
}
// method to evaluate the test result
public int[] evaluateResult() {
int[] resultArray = new int[25];
for (int i = 0; i < 25; i++) {
if (keyArray[i] == answerArray[i]) {
resultArray[i] = 1;
}
}
return resultArray;
}
// method to generate the Driver License Number
public String generateDriverLicenseNumber() {
Random random = new Random();
StringBuilder licenseNumber = new StringBuilder();
for (int i = 0; i < 8; i++) {
licenseNumber.append(random.nextInt(10));
}
return licenseNumber.toString();
}
// method to convert the resultArray to a string
public String getResultString(int[] resultArray) {
}
// method to convert the answerArray to a string
public String getAnswerString() {
StringBuilder answerString = new StringBuilder();
for (int i = 0; i < 25; i++) {
answerString.append(answerArray[i]).append(" ");
}
return answerString.toString();
}
// toString method to display the test result
public String toString() {
int[] resultArray = evaluateResult();
return getResultString(resultArray);
}
}
The text was updated successfully, but these errors were encountered: