genyjoannerubiera
16.04.2020 •
Computers and Technology
Electromagnetismo y magnetismo comparaciones?
Solved
Show answers
More tips
- F Family and Home How to Properly Use a Water Level?...
- D Dating, Love, Relationships 10 Useful Tips on How to Survive a Breakup?...
- F Food and Cooking Apple Cider Vinegar: The Ultimate Health and Beauty Solution...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
- H Health and Medicine Kinesiology: What is it and How Does it Work?...
Answers on questions: Computers and Technology
- C Computers and Technology Suppose company a wants to develop a program that duplicates the functionality of a programm by company b. describe how company a may do this without violating...
- C Computers and Technology Which filter allows you to impart a stamping or raising effect in an image? A. Stylize filter B. Noise filter C. Sharpen filter D. Blur filter E. Texture filter...
- H Health You have been appointed as the head of the IAAF (International Association of Athletics Federations). It is your job to decide if Caster Semenya should be allowed...
- M Mathematics Here s a question ~ p1 and p2 are points on either of the two lines at a distance of 5 units from their point of point of intersection. Find the coordinates of...
- E English Please help me with theseeeeeee:(...
- M Mathematics Cho hai tập hợp A= [ m ; m +1 ] và B= [ 0 ; 3) . Tìm các giá trị của m để : a/ B là tập hợp con của Ab/ A giao B = tập hợp rỗng...
- M Mathematics Help! The table shows the relationship between the number of cups of cereal and the number of cups of raisins in a cereal bar recipe: Number of cups of cereal Number...
- H Health Which of the following statements concerning the human genome are true? Check all that apply. The human genome contains approximately 23,000 nucleotides. The human...
- S Social Studies trình bày nội dung và phương hướng thực hiện Nguyên Tắc đảm bảo tính hệ thống và thuần tự trong dạy học . Đưa ra tình huống dạy học có áp dụng Nguyên Tắc này? (...
- M Mathematics Choose the correct answer...
Ответ:
The code is given below in Java with appropriate comments
Explanation:
//declaring the imports
import java.util.Scanner;
//class FormatName
public class FormatName {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//inputing the names
System.out.print("Enter your name (first middle last): ");
String fullName = scanner.nextLine();
String[] names = fullName.split("\\s+");
//applying the formatting
if (names.length == 2) {
System.out.println("Formatted Name: " + names[1] + ", " + names[0]);
} else if (names.length == 3) {
System.out.println("Formatted Name: " + names[2] + ", " + names[0] + " " + names[1].charAt(0) + ".");
} else {
System.out.println("The input does not have correct form");
}
}
}