(This is a version with input of an exercise from Chapter 1.) Write a
For example, if the user inputs "Walt" for the first name and "Savitch" for the last name, then the program should create a new string with the text "Airway Avitchsay" and print it.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Digital Fundamentals (11th Edition)
Java How To Program (Early Objects)
Starting Out with Programming Logic and Design (4th Edition)
Programming in C
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- Write a program that asks the user to enter a series of single-digit numbers with nothing separating them. Read the input as a C-string or a string object. The program should display the sum of all the single-digit numbers in the string. For example, if the user enters 2514, the program should display 12, which is the sum of 2, 5, 1, and 4. The program should also display the highest and lowest digits in the string.arrow_forwardwrite a program that prompts the user toenter a string and displays the number of vowels and consonants in the string. Assume lettersA, E, I, O, U (or a, e, i, o, u) as the vowels.1. Prompt the user for a String. (Note: The user input String may contain spaces)2. Print the number of vowels and consonants in the String. The count displayed mustaccount for all the vowels and consonants in the String regardless of case (upper orlower case). You must use a loop in your solution.Hint: charAt(index) and length() method for the String, toUpperCase(ch) (ortoLowerCase(ch)), isLetter(ch) method for the Character is helpful for thisassignment3. The output from the program must be enclosed in quotes as shown below in the samplerun of the program.arrow_forward2. Generate a random string of length 10 that contains only lowercase alphabets from 'a' to 'z'. Print the string in the output.arrow_forward
- write a program that prompts the user to input a string. then the program uses the function substr to remove all the vo0wels from the stringarrow_forwardWrite a program that prompts the user to entera string, and counts and displays the number of both lowercase and uppercase vowelsin the string.arrow_forwardYour task is to take 2 strings from the user and then check whether All occurrences of a character of a string must be replaced with another character of another string while preserving the order of characters of strings. Your program just print true or false. Programing language: Javaarrow_forward
- PART 2:Write a program that accepts as input a sentence in which all the words are run together, but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.” If the word is “I”, leave it as an uppercase I. Also check if the sentence ends with a “.”(period). If it does not, add a period at the end of the sentence.You should use a method to perform the editing to the sentence.Print the original sentence and the converted version. You may do this in the method or in the main program, having returned the new string.Repeat this for as many lines as there are in the input file. Use at least 8 lines of data. Have some with only one word. Have some words with only one letter(a), and at least one time the word I in the middle of the sentence. Some should end with a “.” and some…arrow_forwardWhat happens if you try to multiply a string by a string, "a" * "b"?arrow_forwardGiven a string, check if the string contains only uppercase letters or only lowercase letters or both. Print “Uppercase Letters”, “Lowercase Letters” or “Uppercase Letters and Lowercase Letters” for corresponding case. Write in python pleasearrow_forward
- Greece has capital Athens. Each of the strings 'Greece', and 'Athens' has 6 characters. Show the name and capital where the name and the capital have the same number of characters. You can use the LENGTH function to find the number of characters in a stringarrow_forwardString personName is read from input. Output personName left aligned with a width of 6, followed by " Taylor". End with a newline. Ex: If the input is Juno, then the output is: Juno Taylorarrow_forwardAns pleasearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education