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

Write a program that 1. Displays a welcome message of your choice. Prompts the u

ID: 3790535 • Letter: W

Question

Write a program that 1. Displays a welcome message of your choice. Prompts the user for two words then displays the number of characters, and the first and last characters of each word. Next, create 2 new words such that the first word starts and ends with the 1^st and last letter of the second word and the second word starts and ends with the 1^st and last letter of the first word. Display the new words. Displays a closing message. You can assume that the user enters words with at least 2 characters. Assume you have a perfect user who will follow instructions and enter a valid given and family name. Here is a sample output screen. User input is marked by Nancy's text Analyzer Enter 2 words on one line: Nancy Acemian First word you entered is which is 5 characters long. It starts with the letter 'N' and ends with the letter 'y' Second word you entered is which is 7 characters long. It starts with the letter 'A' and with the letter 'n' New words: Aancn Ncemiay Thank you for using Nancy's Text Analyzer

Explanation / Answer

Hi Friend, You have not mentioned about programming languaage.

Please try to provide all details.

I have implemented in JAva.

import java.util.Scanner;

public class StringOperation {

   public static void main(String[] args) {

      

       Scanner sc = new Scanner(System.in);

      

       System.out.println("---------------------------------");

       System.out.println("Nacy's text Analyzer");

       System.out.println("---------------------------------");

      

       System.out.println("Enter two words on two line: ");

       String first = sc.next();

       String second = sc.next();

      

       System.out.println("First word you entered is <"+first+"> which is "+first.length()+" characters long");

       System.out.println("it starts with the letter '"+first.charAt(0)+

               "' and ends with the letter '"+first.charAt(first.length()-1)+"'");

      

       System.out.println();

      

       System.out.println("Second word you entered is <"+second+"> which is "+second.length()+" characters long");

       System.out.println("it starts with the letter '"+second.charAt(0)+

               "' and ends with the letter '"+second.charAt(second.length()-1)+"'");

      

       String word1 = second.charAt(0)+first.substring(1, first.length()-1)+second.charAt(second.length()-1);

       String word2 = first.charAt(0)+second.substring(1, second.length()-1)+first.charAt(first.length()-1);

      

       System.out.println();

      

       System.out.println("New words: "+word1+" "+word2);

       System.out.println();

       System.out.println("Thank you for using Nancy's Text Analyzer!");

   }

}

/*

Sample run:

---------------------------------

Nacy's text Analyzer

---------------------------------

Enter two words on two line:

Nancy Acemian

First word you entered is <Nancy> which is 5 characters long

it starts with the letter 'N' and ends with the letter 'y'

Second word you entered is <Acemian> which is 7 characters long

it starts with the letter 'A' and ends with the letter 'n'

New words: Aancn Ncemiay

Thank you for using Nancy's Text Analyzer!

*/

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