Answer to Question #254549 in Java | JSP | JSF for Mike

Question #254549

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

1
Expert's answer
2021-10-21T05:25:19-0400
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");
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS