Write a program that performs the following: 1) Request a sentence (at least two words with no punctuation marks) input by the user. 2) Display the first word. 3) Display the first letter of the first word. 4) Display the last word. 5) Display the last letter of the last word. Input text can be any content. Just make sure to precisely match the output format below: Write your entire program in the ANSWER area provided below (must include comments if using code is not covered in the course): Example_Output: Enter sentence (at least two words with no punctuation marks): Hello Python World First word: Hello First letter of the first word: H Last word: World Last letter of the last word: d
Added by Marc U.
Step 1
Request a sentence input from the user. Show more…
Show all steps
Your feedback will help us improve your experience
Emily Himsel and 60 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write code that takes a sentence as input from the user and then prints the length of the first word in that sentence. Hint: Think about how you can determine where the first word ends. You can assume that the sentence contains more than one word. Input a code in the following: import java.util.Scanner; public class U2_L3_Activity_Four { public static void main(String[] args) { /* Write your code here */ } }
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD