Three-letter acronyms are common in the business world. For example, in Java you
ID: 667256 • Letter: T
Question
Three-letter acronyms are common in the business world. For example, in Java you use the IDE (Integrated Development Environment) in the JDK (Java Development Kit) to write programs used by the JVM (Java Virtual Machine) that you might send over a LAN (local area network). Programmers even use the acronym TLA to stand for three-letter acronym. Write a program that allows a user to enter three words, and display the appropriate three-letter acronym in all uppercase letters. If the user enters more than three words, ignore the extra words. Figure 7-22 shows a typical execution. Save the file as ThreeLetterAcronym.java.
I have the program i just need the graphical user interface above in java thanks in advance.
Explanation / Answer
public class Acronym {
public static void main(String[] args) {
String phrase = JOptionPane.showInputDialog(null,
"Please enter three words.");
String[] word = phrase.split(" ");
String acronym =
Character.toString(word[0].charAt(0)).toUpperCase() +
Character.toString(word[1].charAt(0)).toUpperCase() +
Character.toString(word[2].charAt(0)).toUpperCase();
JOptionPane.showMessageDialog(null, "Original words were: " +phrase + " Three letter acronym is " + acronym);
}}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.