Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Three-letter acronyms are common in the business world. For example, in Java you

ID: 674885 • 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. Save the file as ThreeLetterAcronym.java.

Purpose:
Create a java program from detailed directions.
Ability to:
Create appropriate variables for the data.
Follow established programming conventions for writing java programs
Able to correctly use arrays
Able to correctly use if statements
Able to input data from the user
Use the print statement for output

Explanation / Answer

Please find required solution:

import java.util.Scanner;

public class ThreeLetterAcronym {
   public static void main(String[] args) {
       // reading input from user
       Scanner input = new Scanner(System.in);
       String sentence = input.nextLine();
       // split sentence(with spaces) into words
       String[] words = sentence.split("\s+");
       // Print 3 letter Upper case Acronym
       int i = 0;
       for (String curr : words) {
           if (i < 3) {
               System.out.print((curr.charAt(0) + "").toUpperCase());
               i++;
           }
       }
       input.close();
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote