a)   To generate the student number it takes three letters(the first, middle and last letter) of the student’s surname and adds it to the first three letters from the first name, then finally adds a three digit postfix number.
b)Â Â Â To generate the email is quite easy it just takes the first letter from the first name and adds it to the surname , then it adds the @students.nust.na postfix
Â
Your task is to create a program that can achieve the above requirements when given the students surname, first name and three digit postfix through CMD arguements
public class InClass01_task01 {
public static void main(String[] args) {
String surname = args[0];
String firstName = args[1];
String threeDigits = args[2];
System.out.println("\nGood day " + firstName + " welcome to NUST");
System.out.println("\nYour email addres is : " + firstName.toLowerCase().charAt(0) + surname.toLowerCase() + "@students.nust.na");
String surnameUpper = surname.toUpperCase();
System.out.println("\n" + surnameUpper.charAt(0) + surnameUpper.charAt(surname.length() / 2) + surnameUpper.charAt(surname.length() - 1)
+ firstName.toUpperCase().substring(0, 3) + threeDigits + "\n");
}
}
Comments
Leave a comment