Welcome to Westonci.ca, your go-to destination for finding answers to all your questions. Join our expert community today! Our platform provides a seamless experience for finding reliable answers from a knowledgeable network of professionals. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
Sagot :
Answer:
In Java:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String name;
System.out.print("First name: ");
name = input.next();
name= name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
System.out.print(name);
}
}
Explanation:
This declares name as string
String name;
This prompts the user for first name
System.out.print("First name: ");
This gets the name from the user
name = input.next();
This capitalizes the first letter of name and makes the other letters to be in lowercase
name= name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
This prints the formatted name
System.out.print(name);
Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. We're here to help at Westonci.ca. Keep visiting for the best answers to your questions.