Explain the major decisions you made in designing a program


Problem

Describe your approach to complete the coding for this problem and explain the major decisions you made in designing a program that meets the specified requirements.

As part of your explanation, be sure to identify the Java constructs you used that are specific and relevant to your program. Depending on the program, these may include the mechanisms for output, input, selection statements, loops, methods, and so forth.

Scanner input = new Scanner(System.in);
System.out.print("Enter a course code to validate (e.g. IT4782): ");
String code = input.nextLine().toUpperCase();
if (code.matches("IT[0-9][0-9][0-9][0-9]")) {
System.out.print("Course code:" + code + " " + "is valid.");

}else if (code.matches("iT[0-9][0-9][0-9][0-9]")) {
System.out.print("Course code:" + code + " " + "is valid.");

}else if (code.matches("It[0-9][0-9][0-9][0-9]")) {
System.out.print("Course code:" + code + " " + "is valid.");

}else if (code.matches("it[0-9][0-9][0-9][0-9]")) {
System.out.print("Course code:" + code + " " + "is valid.");
}else {
System.out.println("Course code:" + code + " " + "is not valid.");
if (code.charAt(0) !='I' && code.charAt(0) !='i') {
System.out.println("First character is not an I or an i.");

}if (code.charAt(1) !='T' && code.charAt(1) !='t') {
System.out.println("Second character is not a T or a t.");

}if (!Character.isDigit(code.charAt(2))) {
System.out.println("Third character is not a digit.");

}if (!Character.isDigit(code.charAt(3))) {
System.out.println("Fourth character is not a digit.");

}if (!Character.isDigit(code.charAt(4))) {
System.out.println("Fifth character is not a digit.");

}if (!Character.isDigit(code.charAt(5))) {
System.out.println("Sixth character is not a digit.");
}
}
}
}

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Explain the major decisions you made in designing a program
Reference No:- TGS03261599

Expected delivery within 24 Hours